SQL Safe Backup offers a number of different ways to initiate a backup/restore operation. Operations can be initiated from the SQL Safe Management Console, the SQL Safe Backup Web Console, the SQL Safe Backup Command Line Interface (CLI), and the SQL Safe Backup Extended Stored Procedures (XSPs). In this blog post, I’d like to quickly introduce the SQL Safe Backup CLI.

When would I use the SQL Safe Backup CLI?

In most cases, there’s probably not need to use the SQL Safe Backup CLI given the other options that are available as I noted earlier. However, knowing that the option is available can be extremely valuable when the need does arise. For instance, in order to restore the master database, it must be performed through the SQL Safe Backup CLI. For users that are heavily dependent on automation through PowerShell or command line scripts, the SQL Safe Backup CLI can be extremely useful.

Example Use Case

Several years ago, I spoke to a user where several of his SQL servers has crashed for whatever reason, including the server hosting the management components of SQL Safe Backup. Prior to this catastrophic failure, he had relied on the SQL Safe Management Console to perform all of his operations for him. However, since central SQL Safe Backup server had crashed, he was in a bit of a panic since he needed to bring so many databases back online. Fortunately for him, the file server which hosted all of the backup files was still functional. After I provided him with an example CLI script to restore a database, he was able to get his environment up and running without prolonging the downtime.

Getting Help

When I first started working the CLI, I was a little uncertain how to construct the commands the script that I needed. For a while, I would use the SQL Safe Management Console to generate a script for me and work from the generated script. To generate a script from SQL Safe Management Console, I would do one of the following:

  1. Use either the SQL Safe Backup Wizard or the SQL Safe Restore wizard to select the basic options that I wanted. At the end of the wizard, I would click the Generate Script button to copy script.

  2. Create a backup/restore/log shipping policy and then look at the properties of the SQL Server Agent job that was created from the policy.

After some time, I realized that the SQL Safe Backup CLI does have its own documentation included in the CLI itself.

SQLsafeCmd.exe help

To get details for a specific action, you can use the following:

SQLsafeCmd.exe <action> help

For example, to get the details for the Backup action, I would use the following:

SQLsafeCmd.exe Backup help


I intended this blog post to be a quick introduction to the SQL Safe Backup CLI. While I know most users are unfamiliar with it, I hope that users find this post and get some ideas how on it can be incorporated into their disaster recovery plans.

Have you had any interesting uses for the CLI? If so, please do share! If you found it useful, it may be that others will find it useful as well!