Depending on which database type you are running, the back-up process will be different.
- Whichever process you run, be sure to document your backup management procedures.
- Perform backups when there is no activity on the server.
Runtime Backup Option for SQLite
The Runtime backup option for SQLite databases guarantees successful backup copies when users are logged in to the server. While the backup is performed, users will be able to browse SystemWeaver data, but any write operation will lock all clients until the backup operation has been completed. Therefore, it is advisable to schedule backups when there is no activity on the server. As always, since each environment is different, it is advisable that you complete a performance test prior.
A backup of a 20 GB SQLite database takes approximately 5 minutes if hardware requirements are met.
Backup Using Bat File
An example of a backup method is provided in the SystemWeaver installation in the form of a backup.bat file and swServerCommand.exe:
swServerCommand backup ServerName=localhost ServerPort=1768
rem swServerCommand backup ServerName=localhost ServerPort=1768 FileName="D:\backup.sqlite"
if %ERRORLEVEL% NEQ 0 (
echo Backup command returned error
The swServerCommand.exe file (see the section swServerCommand in the Help) uses a backup API call in the SystemWeaver server. The script tells the server to create a copy of the database and place it in the location specified in the bat file. You can use a scheduler (Windows or similar) to run the script and take backups on a suitable schedule.
The backup parameter specifies the backup operation.
The ServerName and ServerPort parameters identifies the server.
The FileName specifies the name of the backup file.
If no name is specified an automatic name will be used based on the name of the database file, current date, a random number, and appended with "_backup". Example: "MyDatabase_20160921_172932_959_backup.sqlite". The file will be created in the folder where the SQLite file is located.
The FileRepositoryFileName specifies the name of the backup file for the file repository database.
If no name is specified, an automatic name is used, similar to the case of the database, but appended with "_backup_files.sqlite".
If a file-based file repository is used, an index file backup will be created, appended with "_backup_files_index.db".
Note: If the FileName is specified, but not the FileRepositoryFileName, the script will only perform a backup of the database.
If a script runs successfully, the result in the command window will appear something like the below example:
Compaction of Large SQLite Files
The swDatabaseManager.exe includes an option called Vacuum SQLite database which will minimize the SQLite database file. The benefit of this is that the sheer size of backup copies will become reduced and it will also improve performance to some degree. (This also prevents the file from growing beyond the 2 GB limitation of 32 bit versions of Windows (see Storage and Memory in the Help for more information.)
MS SQL and Oracle
If you are using a MS SQL or Oracle database, refer to the documentation from the supplier of the components you are using for proper backup methods.
Tip: Always make sure that the storage used for database backups is sufficient.
Additional information is available in the Help.