#1 Global Leader in Data Protection & Ransomware Recovery

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: 2024-01-31
mailbox
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

This article documents the procedure for applying a SQL script to a Microsoft SQL database 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 database engine until migrated to PostgreSQL.

Note: For information about applying SQL hotfixes to Veeam ONE, review: KB4414.

Solution

Microsoft SQL

Method 1: Run the Script From the Command Line

To run a SQL script from a command line, perform the following steps:

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

  1. Save the script as a *.sql file (e.g., script.sql) to the local disk.
  2. Make sure that no jobs are running.
  3. Run the following command:
    Reference KB1471 for information about locating Veeam configuration databases

     

psql -d <database_name> -U postgres -f 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"
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.

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.

You have selected too large block!

Please try select less.

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.