Challenge
Instructions to run a SQL script against a MS SQL database.Solution
To run a SQL script from a command line, please perform the following steps:
- Save the script as *.sql file (e.g. script.sql) to local disk
- Make sure that no jobs are running
- Run the following command:
sqlcmd -S <SqlServerName>\<SqlInstanceName> -d <SqlDatabaseName> -i PATHTOSCRIPT\script.sql -o c:\resetresult.txt -I
HKLM\Software\VeeaM\Veeam Backup and Replication\SqlServerName
HKLM\Software\VeeaM\Veeam Backup and Replication\SqlInstanceName
HKLM\Software\VeeaM\Veeam Backup and Replication\SqlDatabaseName
If the script needs to be applied to EM database, please use:
HKLM\Software\VeeaM\Veeam Backup Reporting\SqlServerName
HKLM\Software\VeeaM\Veeam Backup Reporting\SqlInstanceName
HKLM\Software\VeeaM\Veeam Backup Reporting\SqlDatabaseName - Restart the Veeam services
You may also run a SQL script from SQL Server Management Studio, right click on your database and choose the “New query” option, insert the text from the file, and click Execute.
SQL Server Management Studio can be found here:
https://www.veeam.com/kb1761