Depending on which database type you are running, the back-up process will be different. 


Recommendations

  • Whichever process you run, be sure to document your backup management procedures.
  • Perform backups when there is little to 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 and performing write operations. While the backup is performed, users will be able to browse SystemWeaver data, but write operations will lock the client until the backup operation has been completed. Therefore, the only noticeable effect on performance during a backup would be for users who are currently performing a write operation. They may experience a very quick freezing of their screen (similar to a quick glitch). As always, since each environment is different, it is advisable that you complete a performance test prior.


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
@echo off
rem swServerCommand backup ServerName=localhost ServerPort=1768 FileName="D:\backup.sqlite"
FileRepositoryFileName="D:\backup_files.sqlite"
if %ERRORLEVEL% NEQ 0 (
  echo Backup command returned error
  pause
  exit
)

pause


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:


Side Note on MS Windows Backup Utility

The Backup utility in MS Windows will not perform backup of locked files, including database files. This means that the database of a running SystemWeaver server, using a file-based SQLite database, will actually never be backed up by MS Windows. The solution is to first stop the server (see Stopping and starting a SystemWeaver server). An alternative to stopping the server is to make a copy of the file first and then perform the backup on the copy. Since there is always a risk of a concurrent database write transaction, the copied file may become corrupted. To minimize this risk, always perform the backup when there are few users (which may be difficult in a 24/7 situation) typically at night or on a weekend. Backup routines should never be trusted without proper verification. The Administrator should therefore regularly assure that the backups can be restored and that they really represent the intended database copy.


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. 


What's Next?

Additional information is available in the Help.