Please enable JavaScript to view this site.

SQL Backup Master Help

Navigation: Tools

Command line interface

Scroll Prev Top Next More

SQL Backup Master provides a simple command line interface that allows you to trigger a backup job to start.

 

This capability can be useful if you have advanced backup scheduling needs, in which case you can use the SQL Backup Master command line interface in conjunction with Windows Task Scheduler. Or you might elect to use the command line interface from your custom batch scripts.

 

Available command line arguments are explained below.

 

/jobName "<backup-job-name>"

 

This parameter is required in order to the product in command line mode. Replace <backup-job-name> with the name of the backup job you want to start. For example:

 

SqlBackupMaster.exe /jobName "Order database backup"

 

Note that the backup job name above is not case sensitive.

 

/backupType "<backup-job-type>"

 

Use this optional parameter to determine the type of backup to start. If you don't provide this parameter, a "full" backup type is assumed.

 

Valid backup types include "full" (full backup), "diff" (differential backup), and "log" (transaction log backup). For example:

 

SqlBackupMaster.exe /jobName "Order database backup" /backupType "diff"

 

The backup type parameter value is not case sensitive.

 

/awaitResult

 

Use this optional parameter to await the result of the backup job.

 

Important: Use of this flag alters the behavior described in the Command Processing section below.

 

When awaiting the job result, the SQLBackupMaster.exe process exit code will reflect the final backup job status, as follows:

 

Exit Code

Meaning

0

Job executed to successful completion

1

Job execution failed to start* or unexpected failure

2

Backup job finished with failed status

3

Backup job finished with errors

4

Backup job was cancelled

 

In cases where the job exit code is 1, an error message will be written to the Windows event log.

 

Important: Because SQLBackupMaster.exe isn't a console application, launching it directly from cmd.exe will not await its completion. You can work around this by using start /w instead. For example:

 

start /W "c:\Program Files (x86)\Key Metric Software\SQL Backup Master\SqlBackupMaster.exe" /jobName "Order Database Backup" /awaitResult

 

Important: The ability to await backup job results is not designed for high-volume workloads. We recommend not awaiting results for more than a few backup jobs at any given time.

 

* A backup job may fail to start if it cannot be found (an incorrect job name was provided) or if that job is already running.

 

Command Processing

 

By default, command line calls to SqlBackupMaster.exe will start the specified backup job and exit immediately. This allows you to start multiple backup jobs in sequence, if needed, without waiting for any of them to complete.

 

If the backup job was started successfully by the command line interface, the process exit code will be zero (0). If the backup job could not be started for any reason, the exit code will be one (1). If you need additional details about the execution state of a backup (such as the final backup success or error state), you'll need to review backup log for that job. You can use the /awaitResult flag described above to alter this behavior.

 

Once the backup job is up and running, it will be processed just as it would if you had started it via the SQL Backup Master user interface. All settings for the job will be honored, log entries will be created, notifications will be sent, etc.

 

Finally, please note that it will usually be necessary to specify a fully qualified path to the SQL Backup Master executable (SqlBackupMaster.exe). For example:

 

"C:\Program Files (x86)\Key Metric Software\SQL Backup Master\SqlBackupMaster.exe" /jobName "Order database backup" /backupType "diff"

 

If the full path contains spaces (as it does in the example above), you'll need to surround it with quotes.