The application is a console utility, the main purpose of which is to run a backup job described in a special JSON file.
Preparation for Use
SqlBak-CLI does not require administrator permission to perform backups. However, in order to avoid permission issues, it is advisable to run the following command on behalf of the administrator (sudo):
Windows
Linux
This command creates the needed directory structure and grants the necessary permission for the correct work of the application.
Backup
To start using the utility, you need to create a JSON file that contains a description of the settings for connecting to the storage locations where backups will be sent.
You can create a file in any text editor. Create a backup-job.json file:
Replace the values of sql-server-sa-password and my-db-name with your values. In the Path field, enter the path where the backups should be stored.
That JSON file should be specified in the --job-settings parameter during running a backup job:
This command will start performing a full backup according to the settings in the backup-job.json file.
To run a transaction log or differential backup, you need to specify the corresponding parameter in the --backup-type parameter. Use the following command to perform an incremental backup::
SqlBak-CLI will display the backup job execution log. If the job is completed successfully, the application will return a zero exit code.
Restore
A backup can be restored manually. But it’s easier to do it via sqlbak-cli. The application will find the backup, download and restore it.
To restore, please create a JSON settings file for a restore job.
Use --job-settings argument in the run-restore command to specify the file with the settings:
SqlBak-CLI will display the restore job execution log. If the job is completed successfully, the application will return a zero exit code.