Below are examples of commands and configuration files for the SqlBak-CLI utility:
1. Backup three databases, and transfer them to a Linux server via SSH (SFTP)
Command to run a backup
Backup settings
Command to run a restore
Restore settings
2. Backup all databases and send them to Backblaze storage
Command to run a backup
Backup settings
To backup all the available databases there is no need to list all of them, instead specify mssql_custom and the application will backup all databases.
Command to run a restore
Restore settings
There is no way to restore all the backups at once. The backups that should be restored should be listed.
3. Full and differential backups of two databases and upload backups to FTP without compression
Command to run full backup
Command to run differential backup
To run a differential backup, the following parameter --backup-type should be specified:
Backup settings
Settings for full and differential backups are set in one file. However, in the keep_settings section, a different retention period for different types of backups can be specified.
In the example below, full backups will be deleted if they are older than 120 hours, and differential backups will be deleted after 10 hours.
Command to run a restore
Restore settings
To restore a differential backup, SqlBak-CLI will download both the needed full backup and the differential backup, and then restore them sequentially.
4. Using an emergency backup storage
Command to run a backup
Backup settings
In this example, a backup will be sent to SFTP (over SSH). If an error occurs during the transfer, the backup will be saved in the local folder.
Command to run a restore
Restore settings
5. Using GFS Backup Storage Strategy
To implement the GFS (Grandfather-Father-Son) strategy, three backup types should be performed:
FULL
Differential (DIFF)
Transaction Log (LOG)
In the keep_settings section, different intervals for storing each backup type should be specified:
FULL backups are stored for 180 days
DIFF backups are stored for 30 days
LOG backups are stored for 7 days
Set a backup schedule with different intervals for each backup type. CRON tasks for Linux or Task Scheduler for Windows can be used to set a backup schedule: