Restore with Command-Line Interface

You can restore backup of Microsoft SQL Server databases with Veeam Plug-in using the MSSQLRecoveryManager.exe command-line tool.

If you want to restore databases from a Veeam Plug-in backup on another server, launch the wizard on the target server, where you want to place the new database backup.

To perform restore with the command-line interface, do the following:

  1. On the Microsoft SQL Server machine, navigate to the %PROGRAMFILES%\Veeam\Plugins\Microsoft SQL\ folder.
  2. Run the MSSQLRecoveryManager.exe command with the required parameters. For more information, see Configuration Parameters.

For example, to restore a Microsoft SQL Server database, use the following command:

MSSQLRecoveryManager.exe --restore --src_server="srv16" --src_instance="MSSQLSERVER" --src_database="IT" --src_backup="srv16 SQL Backup (Backup Vol 01)" --date="2022-08-17 09:03:49" --dst_instance="MSSQLSERVER" --dst_database="IT_restored" --recovery_state="recovery" --f="'IT'::'DC:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\IT.mdf'" --f="'IT_log'::C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\IT_log.ldf'"

Exit Codes

The MSSQLRecoveryManager.exe command can return the following exit codes:

Restore Parameters

You can specify the following parameters for database restore with the MSSQLRecoveryManager.exe command:

Command

Description

--help

Shows the list of parameters for the MSSQLRecoveryManager.exe command.

--restore

Defines the restore operation.

--src_server

Specifies the name of the original server that contained the backed-up database.

--src_instance

Specifies the name of the original Microsoft SQL Server instance that contained the backed-up database.

--src_cluster

Specifies the name of the original Microsoft SQL Server cluster that contained the backed-up database.

--src_aon

Specifies the name of the original Always On availability group that contained the backed-up database.

--src_database

Specifies the name of the database that you want to restore.

--src_backup

Specifies the name of the Veeam Backup & Replication job that created the backup of the database you want to restore.

This parameter is available in Veeam Backup & Replication 12.

--src_backup_id

Specifies the unique identifier of the Veeam Backup & Replication job that created the backup of the database you want to restore.

If the unique identifier of the backup is not specified, you can use the name of the backup.

Keep in mind that if you specify both or neither the --src_backup and --src_backup_id parameters when you initiate a restore script, the restore operation will fail.

--point_in_time

Specifies the point in time to which you want to restore the database.

This parameter is optional. If you do not use this parameter, Veeam Plug-in will restore the database to the time when the latest restore point was created.

--dst_instance

Specifies the name of the target Microsoft SQL Server instance.

The following values are possible:

  • value is not specified — for default instance that resides on the standalone server
  • <hostname>\<instance_name> — for named instance that resides on the standalone server
  • <cluster_name> — for default instance that resides on the cluster node
  • <cluster_name>\<instance_name> — for named instance that resides on the cluster node

where:

  • <hostname> — name of the host
  • <instance_name> — name of the Microsoft SQL Server instance
  • <cluster_name> — name of the cluster

--dst_database

Specifies the name of the restored database.

This parameter is optional. If you do not use this parameter, Veeam Plug-in will restore the database with its original name.

If you restore the database with its original name to the original location, the original database will be overwritten.

--recovery_state

Specifies the recovery state. Possible values:

  • recovery. Rolls back (undo) any uncommitted changes.
  • norecovery. Skips the undo phase so that uncommitted or incomplete transactions are held open. This allows further restore stages to carry on from the restore point. When applying this option, the database will be in the norecovery state and inaccessible to users.
  • standby. The database will be in the standby state and therefore available for read operations. You can also provide a standby file with uncommitted transactions.

--standby_file_path

Specifies the path to a standby file with uncommitted transactions.

--f

Specifies the rules for database file mapping. Provide mapping rules in the following format: --f="'<DisplayName>'::'<TargetFileLocation>'".

For example: --f="'DB'::'D:\SQLServer\Data\DB.mdf'".

This parameter is optional. If you do not use this parameter, Veeam Plug-in will place database files to the same location and with the same name as for the original database.