https://login.veeam.com/en/oauth?client_id=nXojRrypJ8&redirect_uri=https%3A%2F%2Fwww.veeam.com%2Fservices%2Fauthentication%2Fredirect_url&response_type=code&scope=profile&state=eyJmaW5hbFJlZGlyZWN0TG9jYXRpb24iOiJodHRwczovL3d3dy52ZWVhbS5jb20va2IxNDQzIiwiaGFzaCI6ImE5NGVkODk5LTBjZDEtNDIwNy1iNDczLWFmODE2Yzg1YTk0YyJ9
1-800-691-1991 | 9am - 8pm ET
EN

How to apply a SQL script

Purpose

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:

  1. Save the script as *.sql file (e.g. script.sql) to local disk
  2. Make sure that no jobs are running
  3. 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
  4. 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
 

KB ID:
1443
Product:
Veeam ONE, Veeam Backup & Replication
Version:
All
Published:
2011-12-14
Last Modified:
2020-08-13
Please rate how helpful this article was to you:
5 out of 5 based on 1 ratings
Thank you for helping us improve!
An error occurred during voting. Please try again later.

Couldn't find what you were looking for?

Below you can submit an idea for a new knowledge base article.
Report a typo on this page:

Please select a spelling error or a typo on this page with your mouse and press CTRL + Enter to report this mistake to us. Thank you!

Spelling error in text

Knowledge base content request
By submitting, you agree that your personal data will be managed by Veeam in accordance with the Privacy Policy.
Your report was sent to the responsible team. Our representative will contact you by email you provided.
We're working on it please try again later