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:
- On the Microsoft SQL Server machine, navigate to the %PROGRAMFILES%\Veeam\Plugins\Microsoft SQL\ folder.
- 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'" |
The MSSQLRecoveryManager.exe command can return the following exit codes:
- -1 — the service returns this code when the backup or restore process fails with an error.
- 0 — the service returns this code when the backup or restore process is successful.
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.
|
--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:
where:
|
--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:
|
--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. |