Quantcast
Channel: Veeam Support Knowledge Base
Viewing all articles
Browse latest Browse all 4362

How to apply a SQL script

$
0
0

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:

  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
 


Viewing all articles
Browse latest Browse all 4362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>