KB ID: | 1471 |
Product: |
Veeam Backup & Replication Veeam Service Provider Console Veeam Cloud Connect |
Published: | 2012-01-06 |
Last Modified: | 2024-08-02 |
Languages: | JP |
Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest
Please, try again later.
This article documents methods to back up Microsoft SQL and PostgreSQL databases.
This article also documents how to locate the configuration database for
For information about Veeam ONE, please see: KB2356
For versions of Veeam Backup & Replication or Veeam Cloud Connect older than version 12, please click here to be taken to the legacy section of this article.
Run the following PowerShell script on the server where either Veeam Backup & Replication or Veeam Cloud Connect is installed and it will output the database connection information.
The script below simply pulls information from specific registry values and displays those values in the PowerShell console. No changes will be made to the system.
$activeConfig = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations' -Name 'SqlActiveConfiguration').SqlActiveConfiguration
if ($activeConfig -eq "MsSql") {
$sqlServerName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\MsSql' -Name 'SqlServerName').SqlServerName
$sqlInstanceName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\MsSql' -Name 'SqlInstanceName').SqlInstanceName
$sqlDatabaseName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\MsSql' -Name 'SqlDatabaseName').SqlDatabaseName
Write-Host " Database Engine: $($activeConfig) "
Write-Output "Connection Settings: $($sqlServerName)\$($sqlInstanceName)"
Write-Output "Database Name: $($sqlDatabaseName)"
} elseif ($activeConfig -eq "PostgreSql") {
$pgServerName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\PostgreSql' -Name 'SqlHostName').SqlHostName
$pgPortNumber = (Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\PostgreSql' -Name 'SqlHostPort')
$pgDatabaseName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\PostgreSql' -Name 'SqlDatabaseName').SqlDatabaseName
$pgUser = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\DatabaseConfigurations\PostgreSql' -Name 'PostgresUserForWindowsAuth').PostgresUserForWindowsAuth
Write-Host "Database Engine: $($activeConfig)"
Write-Output "Connection Settings: $($pgServerName):$($pgPortNumber)"
Write-Output "Database Name: $($pgDatabaseName)"
Write-Output "PostgreSQL User: $($pgUser)"
}
For versions Enterprise Manager older than version 12, please click here to be taken to the legacy section of this article.
Run the following PowerShell script on the server where Enterprise Manager is installed and it will output the database connection information.
The script below simply pulls information from specific registry values and displays those values in the PowerShell console. No changes will be made to the system.
$activeConfig = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations' -Name 'SqlActiveConfiguration').SqlActiveConfiguration
if ($activeConfig -eq "MsSql") {
$sqlServerName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\MsSql' -Name 'SqlServerName').SqlServerName
$sqlInstanceName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\MsSql' -Name 'SqlInstanceName').SqlInstanceName
$sqlDatabaseName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\MsSql' -Name 'SqlDatabaseName').SqlDatabaseName
Write-Host " Database Engine: $($activeConfig) "
Write-Output "Connection Settings: $($sqlServerName)\$($sqlInstanceName)"
Write-Output "Database Name: $($sqlDatabaseName)"
} elseif ($activeConfig -eq "PostgreSql") {
$pgServerName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\PostgreSql' -Name 'SqlHostName').SqlHostName
$pgPortNumber = (Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\PostgreSql' -Name 'SqlHostPort')
$pgDatabaseName = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\PostgreSql' -Name 'SqlDatabaseName').SqlDatabaseName
$pgUser = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup Reporting\DatabaseConfigurations\PostgreSql' -Name 'PostgresUserForWindowsAuth').PostgresUserForWindowsAuth
Write-Host "Database Engine: $($activeConfig)"
Write-Output "Connection Settings: $($pgServerName):$($pgPortNumber)"
Write-Output "Database Name: $($pgDatabaseName)"
Write-Output "PostgreSQL User: $($pgUser)"
}
This section contains information specific to all versions of Veeam Backup & Replication, Veeam Cloud Connect, and Enterprise Manager prior to version 12.
If you are providing the database backup to Veeam Support, we ask that you please compress (ZIP) the resulting database backup file before attaching it to the case. This will save bandwidth and time for both you and the support engineer assisting you.
Most database backup files will compress to 15% of their original size.
*The Backup-SqlDatabse PowerShell cmdlet is part of a module installed with Microsoft SQL and must be run on the Microsoft SQL server itself. The command will fail if Microsoft SQL is not installed on the machine where the cmdlet is executed.
Run the following command, filling in Microsoft SQL connection information and output destination:
*The following command assumes that the Microsoft SQL Instance uses Windows authentication and that the account used to execute the command has the appropriate privileges to perform a database backup.
Backup-SqlDatabase -ServerInstance "ServerName\InstanceName" -Database "DBName" -BackupFile "C:\Temp\DBBackup_$($env:computername)_$(get-date -f yyyy-MM-dd_HH.mm).bak"
*sqlcmd is an application that is installed with Microsoft SQL. If Microsoft SQL is not installed on the machine where the command is executed, sqlcmd will not exist, and the command will fail.
Run the following command, filling in Microsoft SQL connection information and output destination:
*The following command assumes that the Microsoft SQL Instance uses Windows authentication and that the account used to execute the command has the appropriate privileges to perform a database backup.
SqlCmd -E -S ServerName\InstanceName -Q "BACKUP DATABASE [DBName] TO DISK='C:\Temp\DBBackupFilename.bak' WITH STATS"
If you are providing the database backup to Veeam Support, we ask that you please compress (ZIP) the resulting database backup file before attaching it to the case. This will save bandwidth and time for both you and the support engineer assisting you.
Most database backup files will compress to 15% of their original size.
Note:
In an Administrator elevated PowerShell console, run the following command:
& "C:\Program Files\PostgreSQL\15\BIN\pg_dump.exe" -U postgres -F c -b -f "C:\Temp\PGDBBackup_$($env:computername)_$(get-date -f yyyy-MM-dd_HH.mm).sql" VeeamBackup
The SSPI Authentication error most often occurs when the user account that executed the pg_dump command is not mapped correctly.
pg_dump: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: SSPI authentication failed for user "postgres"
To resolve this issue, review KB4542.
Your feedback has been received and will be reviewed.
Please, try again later.
Please try select less.
This form is only for KB Feedback/Suggestions, if you need help with the software open a support case
Your feedback has been received and will be reviewed.
Please, try again later.