Overview

As we know, Veeam has released version 12, which includes PostgreSQL as the default database. For new installations, PostgreSQL will be used by default. However, if you upgraded Veeam from a previous version, you can still using the SQL Express 2016.

It is important to note that Veeam uses the SQL Express edition, which have some limitation below:

  • Use of one socket or four cores
  • Use of only 1.4GB per instance
  • 10GB limit for databases

As the database grows due to large backup, there is a risk that it might become full, potentially disrupting backups. In such a situation, cleaning the database logs is necessary. To avoid this issue, you can switch the SQL database to PostgreSQL, which does not have this limitation.

System Requirement.

  • Ensure that the OS version running the Veeam is compatible with Veeam B&R. Here is the supported 64-bit Microsoft Windows operating systems:

    • Microsoft Windows Server 2022
    • Microsoft Windows Server 2019
    • Microsoft Windows Server 2016
    • Microsoft Windows Server 2012 R2
    • Microsoft Windows Server 2012
    • Microsoft Windows 11 (versions 21H2, 22H2, 23H24)
    • Microsoft Windows 10 (from version 1909 to version 22H2)
    • Microsoft Windows 10 LTS (versions LTSB 1607, LTSC 1809, LTSC 2021)
  • Ensure the database version is compatible and supported with Veeam B&R server.

  • PostgreSQL

    • PostgreSQL 14.x
    • PostgreSQL 15.x (PostgreSQL 15.6.1 is included in the Veeam Backup & Replication 12.1 setup)
  • Microsoft SQL Server:

    • Microsoft SQL Server 2022
    • Microsoft SQL Server 2019
    • Microsoft SQL Server 2017
    • Microsoft SQL Server 2016
    • Microsoft SQL Server 2014
    • Microsoft SQL Server 2012

Before You Begin

Prior to switching over the database, it is strongly recommended to back up the database, and its config. In case something goes wrong after switchover, you can easily restore the config, or its database.

  1. Backup Current DB config.

Run the following command to show the current database config.

$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)"
}
  1. Backup the database. Use the following powershell command to backup the database.

This is optional step but highly recommended, just in case your Veeam breaks after this switchover, you can still restore the config from Veeam backup config or from this backed up database.

Backup-SqlDatabase -ServerInstance "ServerName\InstanceName" -Database "DBName" -BackupFile "C:\Temp\DBBackup_$($env:computername)_$(get-date -f yyyy-MM-dd_HH.mm).bak"
  1. Close the Veeam console.

Install and configure PostgreSQL.

  1. Download the latest version of postgresql for windows
  2. Install and Set a password for the PostgreSQL administrator user.
  3. After the installation finishes, open pgAdmin.
  4. Create a local user in PostgreSQL named veeambackup with Superuser permissions, so that this user can create a Veeam database and perform all necessary processes during the migration process.
  5. On the privileges tab, enable the following:
    • Can login.
    • Superuser
    • Create Database
    • Inherit rights from the parent roles
  6. Set the password. This user and credential will be used to setup the Veeam database connection later.

Backup Veeam Configuration.

  1. From the main menu, select Configuration Backup.
  2. Make sure that the Enable configuration backup to the following repository check box is selected.
  3. From the Backup repository list, choose a backup repository on which the configuration backup must be stored.
  4. In the Restore points to keep field, specify the number of restore points that you want to maintain in the backup repository.
  5. To create an encrypted backup, select the Enable backup file encryption check box. From the Password field, select a password you want to use for encryption. If you have not created a password beforehand, click Add or use the Manage passwords link to specify a new password.
  6. Click Backup now.

Migrating the Configuration Database to PostgreSQL

Prior to migrate, please ensure the following:

  • Disable all backup jobs to ensure that nothing jobs run during this process.
  • Close the console and open the Configuration Restore application.
  1. Open the Configuration Restore
  2. Select Migrate option.
  3. Choose the configuration backup file we created earlier.
  4. Validate the backup content.
  5. Enter the encryption password for the configuration backup file.
  6. Choose the PostgreSQL option in Database engine, enter the server name (or localhost) and the port that PostgreSQL is using. Then, define the database name and enter the user and password to connect to PostgreSQL.
  7. You will be notified that the database does not exist and will be created during this process.
  8. Choose whether you want to restore the Veeam Backup & Replication catalog and session history.
  9. You will get a notification that services will be restarted.
  10. Waiting the process to complete.
  11. Once all process is completed, execute this command in PowerShell to modify the hardware parameters in PostgreSQL’s configuration to comply with Veeam’s best practices.
Set-VBRPSQLDatabaseServerLimits

Conclusion.

By following these steps, you learn how to switch Veeam database from SQL Server Express to PostgreSQL.