602SQL Documentation Index  

How to Make a Complete Database Backup

One of the ways to protect the database against data loss is to backup the database file on a regular basis. Different database file backup methods and their properties are described below. The method of data backup from tables by exporting data is not described here.

Manually Copy the Database File

You can backup the database by copying the database file manually to a different location. You can do this only when the 602SQL Server is not currently running on this database, otherwise database integrity cannot be guaranteed.

One-time Backup from the Client Environment

In Control Panel, the System / Tools / Automatic backups page, it is possible to press the Backup now button. If the backup parameters are specified in the same window (see the following paragraph - at least the backup directory parameter), the backup is made irrespective of the backup schedule.

Automatic Database Backup

You can setup the Backup... runtime parameters from the control panel folder System / Tools / Automatic backups (or by calling the Get_property_value API function). These backups can be made periodically after or at a specific time and day.

ParameterMeaningValue example
BackupDirectoryBackup foldere:\backup
BackupFilesLimitMaximum number of saved backups7
BackupZipCompress backups1
BackupZipMoveToFolder to store compressed backup filesw:\backup
EITHER Backup periodically
BackupIntervalHoursBackup is made after N hours12
BackupIntervalMinutes ... and M minutes0
OR Backup at the selected time
BackupTimeDay1Day of backup specification 9
BackupTimeHour1Hour of backup specification6
BackupTimeMin1Minute of backup specification0
BackupTimeDay2Day of backup specification9
BackupTimeHour2Hour of backup specification18
BackupTimeMin2Minute of backup specification0
BackupTimeDay3Day of backup specification10
BackupTimeHour3Hour of backup specification0
BackupTimeMin3Minute of backup specification30

In the example, database backups are made every 12 hours or on workdays (Mon-Fri 2 times a day at 6:00 AM and 6:00 PM) and on Sunday and Saturday at 12:30 PM. Day specification classifier:
1Daily
2Monday
3-8Tuesday to Sunday
9Workdays (Mon-Fri)
10Weekends (Sat, Sun)

A backup is created in the folder specified by the BackupDirectory parameter. When the backup count crosses the limit specified by the BackupFilesLimit parameter, the oldest backup will be deleted. The backup files are named in the form YYMMDDhh.mmX, where YYMMDD is year, month, day, and hhmm is the hour and minute. X is A to D and specifies different parts of the database file.

You can restore the database files from the backup files using the Restore now! button in the Management tab on the Database management dialog accessible from the pop-up menu (the 602SQL Server must be stopped before this action can be performed).

If during server operation the backup creation starts in blocking mode, execution of most operations is suspended during the time necessary for creation of file copy. In case of non-blocking mode, you can continue with work.

Immediately after the backup is saved, the system trigger _on_backup is called. It allows you to react either to a successful or unsuccessful backup (e.g. by sending an e-mail to the administrator). Backup compression (see the following) will not affect the results of _on_backup.

Backup Compression

If backup compression is turned on by the BackupZip parameter, each new backup file is compressed immediately after the backup and if specified, the compressed backup is moved to the folder specified by the BackupZipMoveTo parameter.

File compression and moving the backup runs asynchronously in a separate thread, so it does not block other processes on the 602SQL Server.

The compressed backup files are named in the form of YYMMDDhh.mmz.

The backup count is valid even for compressed backups, however the folders BackupZipMoveTo and BackupDirectory must be different.

Backup Directly from an Application

A database backup can be explicitly called by a database application (e.g. if a user selects this option from a menu or when the number of database changes crosses a specified limit).

An explicit backup is made by the Backup_database_file function. Most of the server operations are suspended, just like when running an automatic backup.

Intervention to Backup

Using the _ON_SYSTEM_EVENT generic trigger with event_num parameter equal to 1, you can influence (and even revoke) backup creation.

Blocking x Non-blocking Backup

The database server backup can be created in two possible modes:

The backup modes are selected in Control Panel, System / Tools / Automatic backups page using Do not block the server operation... switch or using Get_property_value) function, you can set server properties to NonblockingBackups.