- Veeam Support Knowledge Base
- How to apply a SQL script to Veeam Backup & Replication/Veeam Backup Enterprise Manager Database
How to apply a SQL script to Veeam Backup & Replication/Veeam Backup Enterprise Manager Database
| KB ID: | 1443 |
| Product: |
Veeam Backup & Replication Veeam Cloud Connect |
| Published: | 2011-12-14 |
| Last Modified: | 2026-08-07 |
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
Oops! Something went wrong.
Please, try again later.
Purpose
This article documents the procedure for applying a SQL script to a Microsoft SQL Server or PostgreSQL Database. Specifically, this article is targeted at the scenario where a support engineer has provided a .sql script to modify the Veeam Backup & Replication or Veeam Backup Enterprise Manager configuration database.
Starting with Veeam Backup & Replication 12, the product now supports the PostgreSQL database engine for storing the configuration database. Please note that existing Veeam Backup & Replication deployments upgraded to version 12 will continue using the Microsoft SQL Server database engine until migrated to PostgreSQL.
Note: For information about applying SQL hotfixes to Veeam ONE, review: KB4414.
Solution
Microsoft SQL Server
Method 1: Run the Script From the Command Line
To run a SQL script from a command line, perform the following steps:
- Save the script as a
.sqlfile (e.g., script.sql) to the local disk. - Make sure that no jobs are running.
- Run the following command:
Reference KB1471 for information about locating Veeam configuration databases.
sqlcmd -S <SqlServerName>\<SqlInstanceName> -d <SqlDatabaseName> -i PATHTOSCRIPT\script.sql -o c:\resetresult.txt -I
Method 2: Run the Script From Microsoft SQL Server Management Studio
You may also run a SQL script from SQL Server Management Studio by right-clicking on the database, then selecting the “New query” option. Then, insert the text from the script file, and click Execute.
PostgreSQL
Method 1: Run the Script From the Command Line
To run a SQL script from a command line, perform the following steps:
- Save the script as a
.sqlfile (e.g., script.sql) to the local disk. - Make sure that no jobs are running.
- Run the following command:
Reference KB1471 for information about locating Veeam configuration databases
&"C:\Program Files\PostgreSQL\17\bin\psql" -d VeeamBackup -U postgres -f "C:\path\to\script.sql"
Method 2: Run the Script From pgAdmin
You may also run a SQL script from pgAdmin by right-clicking on the database, then selecting the “Query Tool” option. Then, insert the text from the script file, and click ▶ to Execute.
Troubleshooting "SSPI authentication failed" PostgreSQL Error
The SSPI Authentication error most often occurs when the user account that executed the psql command is not mapped.
To resolve this issue, review: KB4542: "SSPI authentication failed for user"
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: SSPI authentication failed for user "postgres"
If this KB article did not resolve your issue or you need further assistance with Veeam software, please create a Veeam Support Case.
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.