Performing Backup with Command-Line Interface
You can perform backup of Microsoft SQL Server databases with Veeam Plug-in using the command-line interface.
To perform backup, 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 Backup Parameters.
The following example shows a command to perform full backup of Microsoft SQL Server databases:
MSSQLRecoveryManager.exe --backup --d="IT" --d="Sales" --name="Database Backup" --description="Daily database backup" --type=full --parallelism=2 --instance="dlsql01\MSSQLSERVER" --retention=5 --use_compression --check_preferred |
TIP |
You can also use the available backup parameters to modify Veeam Plug-in for Microsoft SQL Server commands used in custom scripts. For information, see Exporting Backup Settings to Custom Script. |
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 backup of Microsoft SQL Server databases with the MSSQLRecoveryManager.exe command:
Command | Description |
---|---|
--help | Shows the list of parameters for the MSSQLRecoveryManager.exe command. |
--backup | Defines the backup operation. |
--instance | Specifies the name of the Microsoft SQL Server instance whose databases you want to back up. The following values are possible:
where:
|
--d | Specifies the name of the database to back up. This parameter is optional. If you do not use this parameter, Veeam Plug-in will back up all databases of the specified instance. Alternatively, if you want to back up all databases of the instance except for the specified one, you can use the --ed parameter and specify the necessary database as its value. |
--ed | Specifies the name of the database that must be excluded from the backup. This parameter is optional. If you do not use this parameter, Veeam Plug-in will back up all databases of the specified instance. Alternatively, if you want to back up a specific database, you can use the --d parameter and specify the necessary database as its value. |
--name | Specifies the name for the backup set. |
--description | Specifies the description for the backup set. |
--type | Specifies the backup type. Possible values:
|
--copy_only | Defines the copy-only backup mode. You can use this parameter to create copy-only full backups or copy-only log backups of Microsoft SQL Server databases. Keep in mind that differential backups cannot use the copy-only full backup as a starting point. To learn more, see this Microsoft article. |
--parallelism | Specifies the number of parallel data streams over which you want to back up Microsoft SQL Server data. For each backup stream, a separate VDI Device is started on the Microsoft SQL Server machine. |
--retention | Specifies the number of days to keep backups in the backup repository. This parameter is optional. If you do not use this parameter, Veeam Plug-in will not apply the retention policy to the backup. |
--check_preferred | [For backup of Always On Availability Groups] Defines that Veeam Plug-in will check whether the availability replica is the preferred replica for backup. |
--use_compression | Defines that Veeam Backup & Replication mechanisms of data compression will be applied to the backup. To Veeam Plug-in for Microsoft SQL Server backups, the Optimal (ZSTD) compression level is applied. |