Link Search Menu Expand Document

SqlBak-CLI documentation

run-backup command

The command runs a backup process that is described in the --job-settings parameter. All the information about the backup process is displayed in a backup job’s log. If everything that is described in the file cannot be performed, then the application returns a non-zero return code.

The process can be interrupted at any time by pressing Ctrl+C (SIGINT).

Invocation Syntax

Arguments must be specified after the run-backup command:

sqlbak-cli run-backup [ARG...]

Required arguments:

--job-settings

In this parameter, the full path to the JSON file with the description of a backup job should be specified. More information about the specification of the JSON file and the job’s description can be found here.

Optional arguments:

--backup-type

backup type. This parameter determines what data will be included in a backup.

ALLOWED VALUES:

full – A backup contains all the data needed to restore the database.

differential – A backup contains only data that have been changed since the last full backup.

incremental – A backup contains all the data that have been changed since the last backup.

log – A backup contains all transaction log records that have been made between the last transaction log backup or the first full backup and the last log record that is created upon completion of the backup process. (Available for MS SQL Server only).

Learn more about backup types in the SQL Server documentation: differential, transaction log.

--copy-only

A FULL backup created with the COPY_ONLY option does not affect differential and transaction log backups. Differential and transaction log backups ignore backups that have been performed with the COPY_ONLY option when they are executed.

ALLOWED VALUES:

true – The COPY_ONLY option is enabled. A backup will not be needed to restore differential and transaction log backups.

false – The COPY_ONLY option is disabled.

More details about the COPY_ONLY option can be found here.

--log-level

During backup execution, the application displays a job’s log. This parameter is used to specify how detailed a log should be.

ALLOWED VALUES:

error – Only error messages are displayed.

warning – Only error messages or warnings about potential issues in a backup job are displayed.

information – Displays basic messages about the stages of a backup job (default).

debug – Displays all messages, including debug messages.

Examples

Performing a full backup on Windows:

sqlbak-cli run-backup --job-settings=”c:\BackupSettings\db-backup.json”

Performing an incremental backup on Linux:

sqlbak-cli run-backup --job-settings=”~/backup-settings/db-backup.json” 
–backup-type=incremental

For examples of files passed to the --job-setting parameter, see the samples section.