Overview

Due to the SQL 2016 has reached End-Off-Life (EOL), switching the SQL database on Veeam to PostgreSQL, or upgrading the SQL express version to 2022 is crucial to make sure the database engine version is updated. If you prefer to switch the database to PostgreSQL, you can follow This Link.

However, if you are more comfortable, stick with SQL server, you can use the following procedures for upgrading the underlying SQL software to the latest 2022 version.

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

It is highly advisable to create a Configuration and optionally create a Database Backup so that if anything goes wrong, you can restore or roll back the Veeam Backup & Replication configuration.

  1. Ensure that there are no jobs or restore tasks occurring.
  2. Ensure that all Veeam related services are disabled prior to upgrade.
  3. Manually Create a Veeam Configuration Backup.
  4. Create a backup of the Veeam Database.
  5. This update requires a Veeam server reboot, so make sure you carry out scheduled maintenance.

SQL Upgrade Procedure Outline

  1. Stop and Disable all Jobs.
  2. Backup Veeam Configuration.
  3. Backup Veeam Database.
  4. Stop all Veeam services on the Veeam Backup Server
  5. Check the current SQL version.
  6. Update the SQL 2016 with SQL Server 2016 SP3 (KB5003279).
  7. Upgrade the SQL server express version to latest 2022.
  8. After the upgrade completes, restarting the Veeam Backup Server is required.
  9. Re-enable the Jobs you stopped in Step 1.
  10. Testing the backup.

Microsoft SQL Express Upgrade Procedure

These instructions assume you are upgrading the Microsoft SQL Server Express instance that came prepacked with Veeam Backup & Replication. If the deployment of Veeam Backup & Replication you are working with was using a different SQL Server Instance, you may need to adapt some of these steps.

Disable All Bakup and Replication Job

The important step before performing the upgrade preparation, all Backup, Backup copy, and Replication jobs must be disabled. If there’s still a job running, wait them to complete.

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.

Backup Veeam Database.

  1. Check the database connection by running Veeam.Backup.DBConfig.exe on this path
%PROGRAMFILES%\Common Files\Veeam\Backup and Replication\DBConfig\Veeam.Backup.DBConfig.exe

Or, use the following powershell command:

$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)"
}

The results will display the database connection as follows

Database Engine: MsSql
Connection Settings: VEEAMB\VEEAMSQL2016
Database Name: VeeamBackup
  1. Backup the SQL database and match the current database connection information on step 1:
Backup-SqlDatabase -ServerInstance "ServerName\InstanceName" -Database "DBName" -BackupFile "C:\Temp\DBBackup_$($env:computername)_$(get-date -f yyyy-MM-dd_HH.mm).bak"

Check the current SQL version.

Before upgrading the SQL, it’s important to check the current SQL version. So that, we can compare the version after the upgrade.

Invoke-Sqlcmd "select @@version" -ServerInstance "VEEAM\VEEAMSQL2016"

Ensure all jobs, policies, and services are stopped.

  1. Go back to the Veeam B&R console and ensure all jobs, policies, and tasks are stopped, and those that are scheduled to run are disabled.
  2. Close the console, stop all Veeam-related services on the Veeam Backup Server.
Get-Service Veeam* | Stop-Service

Start Upgrading the SQL

  1. Download the MSSQL 2016 SP3, and install this SQL 2016 express SP3 patch. If there’s an error during the patching, fix them and retry the patching.

This Microsoft SQL Server 2016 service packs are cumulative updates and upgrade all editions and service levels of SQL Server 2016 SP1 to SP2. This service pack contains up to and including SQL Server 2016 SP2 Cumulative Update 17 (CU17).

  1. Download the latest version of Microsoft SQL Server 2022 Express that is compatible with Veeam Backup & Replication, or using the latest SQL 2022 ISO.

  2. Mount the downloaded ISO file.

  3. Run Setup.exe on the mounted ISO file.

  4. After the SQL Server Installation shows, Go to Installation tab, and click Upgrade from a previous version of SQL server

  5. On the Edition of SQL server to Install, choose Express edition.

  6. Check the Accept the license terms and privacy, and Next.

  7. Wait for the scan product update to complete.

  8. On the instance, choose VEEAMSQL2016, and click Next.

  9. Check the Database Engine Service.

  10. Select VEEAMSQL2016, and click Next.

  11. Waiting for the Upgrade advisor to complete. If you see any error status on this phase, fix the error,and Rerun the proses.

  12. If the pre-install check completes without any failures and all status are Passed, click Next.

If upgrading process requires the server reboot, go ahead reboot the server, and re-run the installer from step 1.

  1. Click Upgrade to start the upgrade.

Update the database’s Compatibility level

After upgrading the Microsoft SQL Server instance, remember to update the database’s Compatibility level.

  1. To check the current database’s Compatibility level, you can either using MSSQL Management Studio.
    • Right click on the VeeamBackup database.
    • Got to Options, and change Compatibility Level to SQL Server 2022 (160)

If you don’t install the management studio, do this remotely from the another SQL server with management studio installed, or using this powershell command.

Get-SqlDatabase -ServerInstance "VEEAMB\VEEAMSQL2016" | where {$_.Name -eq "Veeambackup"}

The result is follow:

Name                 Status          Containment Type Recovery Model CompatLvl Collation                      Owner
----                 ------          ---------------- -------------- --------- ---------                      -----
VeeamBackup          Normal          None             Simple               130 SQL_Latin1_General_CP1_CI_AS   NT AUTHORITY\SYSTEM

CompatLvl 130 means that the compatibility level on the VeeamBackup database is still SQL Server 2016

  1. Change the Compatibility Level from SQL Server 2016 (130), to SQL Server 2022 (160). Here is the list of SQL compability level until the SQL 2022 version.
SQL SERVER 2008 (100)
SQL SERVER 2012 (110)
SQL SERVER 2014 (120)
SQL SERVER 2016 (130)
SQL SERVER 2017 (140)
SQL SERVER 2019 (150)
SQL SERVER 2022 (160)
  1. Change / Update the compatibility level using MSSQL Management Studio, or using the following powershell command to SQL Server 2022 (160)
Invoke-Sqlcmd "ALTER DATABASE VeeamBackup SET COMPATIBILITY_LEVEL = 160" -ServerInstance "VEEAM\VEEAMSQL2016"
  1. Re-check the Compatibility Level of the database, and ensure the database Compatibility Level is changed to SQL Server 2022 (160).
Name                 Status          Containment Type Recovery Model CompatLvl Collation                      Owner
----                 ------          ---------------- -------------- --------- ---------                      -----
VeeamBackup          Normal          None             Simple               160 SQL_Latin1_General_CP1_CI_AS   NT AUTHORITY\SYSTEM
  1. Restart the Veeam Backup Server.

Note: The Veeam services are set to “Automatic (Delayed Start).” After the reboot, please allow the services time to start before opening the Veeam Backup & Replication Console. Remember to enable the Jobs you stopped in Step 1.

Conclusion.

Upgrading the Veeam backup and replication server to the latest version periodically as well as updating the Veeam SQL database or PostgreSQL database to the latest version is very crucial to ensure your Veeam backup and replication remains secure and updated.