How to apply a SQL script

KB ID: 1443
Product: Veeam ONE
Veeam Backup & Replication
Version: All
Published: 2011-12-14
Last Modified: 2021-06-14
Get weekly article updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.

Cheers for trusting us with the spot in your mailbox!

Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest

error icon

Oops! Something went wrong.

Please try again later.

Purpose

Instructions to run a SQL script against a MS SQL database.

Solution

To run a SQL script from a command line, 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
    
  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://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

 

Information about the Veeam Backup & Replication configuration database can be found in the registry under these registry values:

  • 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 the Backup Enterprise Manager database, please use:

  • HKLM\Software\VeeaM\Veeam Backup Reporting\SqlServerName
  • HKLM\Software\VeeaM\Veeam Backup Reporting\SqlInstanceName
  • HKLM\Software\VeeaM\Veeam Backup Reporting\SqlDatabaseName
Click here to send feedback regarding this KB, or suggest content for a new KB.
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Spelling error in text

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

Oops! Something went wrong.

Please try again later.

KB Feedback/Suggestion

This form is only for KB Feedback/Suggestions, if you need help with the software open a support case

By submitting, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Verify your email to continue your product download
We've sent a verification code to:
  • Incorrect verification code. Please try again.
An email with a verification code was just sent to
Didn't receive the code? Click to resend in sec
Didn't receive the code? Click to resend
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

error icon

Oops! Something went wrong.

Please try again later.