Skip to main content

Upgrading the SQL Database Engine Software (PostgreSQL) Used by Veeam Backup & Replication

  • February 19, 2025
  • 19 comments
  • 10540 views

Link State
Forum|alt.badge.img+12

Hi all,

I attach the step by step procedure to perform a PostgreSQL Database upgrade.

 

PostgreSQL: CVE-2025-1094: PostgreSQL quoting APIs miss neutralizing quoting syntax in text that fails encoding validation

 

KB4386: Upgrading the SQL Database Engine Software (Microsoft SQL Server or PostgreSQL) Used by Veeam Backup & Replication

 

  1. Ensure that there are no jobs or restore tasks occurring.
  2. Manually Create a Configuration Backup.
  3. (Optional) Create a backup of the Configuration Database.

 

  1. Stop and Disable all Jobs
  2. Stop all Veeam services on the Veeam Backup Server
  3. Upgrade the SQL database software.
  4. After the upgrade completes, restart the Veeam Backup Server

PostgreSQL Upgrade Procedure

  1. Ensure all jobs, policies, and tasks are stopped, and those that are scheduled to run are disabled.
  2. Stop all Veeam-related services on the Veeam Backup Server.
  3. Get-Service Veeam* | Stop-Service -Force
  1. Download the latest version of PostgreSQL that is compatible with Veeam Backup & Replication.
    Note: The most recent version of PostgreSQL may not be supported by Veeam Backup & Replication, it is critical that you check the compatibility list in the Veeam Backup & Replication User Guide for details.
  • Identify VBR Database
$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)"
}
  • Identify VEM Database
$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)"
}
  • Check PostgreSQL version
  • Backup PostgreSQL from CLI
Backup PostgreSQL from CLI
cd "C:\Program Files\PostgreSQL\15\BIN"
pg_dump -U postgres -d “yourDB-name” > C:\BackupPostgreSQL15\“yourDB-name” sql
pg_dump -U postgres -d “yourDB-name” > C:\BackupPostgreSQL15\“yourDB-name”.sql
  • Lunch installer\upgrade

C:\temp\postgresql-15.11-1-windows-x64.exe --mode unattended --disable-components stackbuilder

 

Reboot VBR re – enable jobs check version PostgreSQL

regards & enjoy

19 comments

Chris.Childerhose
Forum|alt.badge.img+21
  • Veeam Legend, Veeam Vanguard
  • February 19, 2025

This is a great article and came out at a good time as there have been questions around whether Veeam upgrades Postgres.  Thanks for sharing this one!  👍🏼


Link State
Forum|alt.badge.img+12
  • Author
  • Veeam Legend
  • February 19, 2025

This is a great article and came out at a good time as there have been questions around whether Veeam upgrades Postgres.  Thanks for sharing this one!  👍🏼

you are welcome 😁


dloseke
Forum|alt.badge.img+8
  • Veeam Vanguard
  • February 19, 2025

Thank you ​@Link State  for posting this.  As Chris noted, there were other questions about this so this couldn’t have come at a better time and I actually thought it was a response to another thread that I’m tagging below.
 

 


Iams3le
Forum|alt.badge.img+13
  • February 19, 2025

This is a great article and came out at a good time as there have been questions around whether Veeam upgrades Postgres.  Thanks for sharing this one!  👍🏼

Exactly. I saw your response on that earlier. This is a very great and tailored guide ​@Link State!  


matheusgiovanini
Forum|alt.badge.img+9

Great post! The step-by-step guide on upgrading PostgreSQL for Veeam was really helpful. Stopping all services and making sure jobs are paused before upgrading is a key detail. I used this guide to upgrade my environment successfully—thanks for sharing such a clear and useful resource


Hi.

 

I have a question:

So upgrading PostgreSQL to 15.12 is supported by VBR, and 16.8 and 17.4 isn't in this moment, right?

Does 15.12 resolves current CVE threats?

 


Link State
Forum|alt.badge.img+12
  • Author
  • Veeam Legend
  • March 14, 2025

Hi.

 

I have a question:

So upgrading PostgreSQL to 15.12 is supported by VBR, and 16.8 and 17.4 isn't in this moment, right?

yes

Does 15.12 resolves current CVE threats?

yes

 

yes this fix was included starting from version 15.11.


Thank you for your reply.
Just to clarify.

Per URL: “https://helpcenter.veeam.com/docs/backup/vsphere/system_requirements.html?zoom_highlight=versions%20of%20PostgreSQL&ver=120

PostgreSQL 15.x is compatible, including 15.12?

 


Chris.Childerhose
Forum|alt.badge.img+21

Thank you for your reply.
Just to clarify.

Per URL: “https://helpcenter.veeam.com/docs/backup/vsphere/system_requirements.html?zoom_highlight=versions%20of%20PostgreSQL&ver=120

PostgreSQL 15.x is compatible, including 15.12?

 

Yes it is compatible.


Thanks Chris.


  • New Here
  • April 16, 2025

Thanks so much


  • New Here
  • November 24, 2025

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

 

I follow this step to upgrade to PostgreSQL 17.6-1. Completed successfully.

 

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

 

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

 

Because now I have both directories, C:\Program Files\PostgreSQL\15\BIN and C:\Program Files\PostgreSQL\17\BIN and running psql -V in each directory show different version respective to the parent directory.


Chris.Childerhose
Forum|alt.badge.img+21
  • Veeam Legend, Veeam Vanguard
  • November 24, 2025

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

 

I follow this step to upgrade to PostgreSQL 17.6-1. Completed successfully.

 

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

 

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

 

Because now I have both directories, C:\Program Files\PostgreSQL\15\BIN and C:\Program Files\PostgreSQL\17\BIN and running psql -V in each directory show different version respective to the parent directory.

You need to be careful because if your database is in the 15 directory you could possibly affect Veeam.  Just take a configuration backup and then do it worse case you restore.  I don't think it will touch the DB though.


Iams3le
Forum|alt.badge.img+13
  • November 24, 2025

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

This is a different us-case, but might be helpful.

Why not check if PostgreSQL 15 is stopped, and if 17 is running. If yes, you can safely remove the program. You can also check via PS: "C:\Program Files\PostgreSQL\17\bin\psql.exe" -U veeam -d VeeamBackup -p 5432 or run sql: SELECT version(); will help determine which PostgreSQL version your Veeam Db is running on


  • New Here
  • January 22, 2026

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

 

I follow this step to upgrade to PostgreSQL 17.6-1. Completed successfully.

 

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

 

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

 

Because now I have both directories, C:\Program Files\PostgreSQL\15\BIN and C:\Program Files\PostgreSQL\17\BIN and running psql -V in each directory show different version respective to the parent directory.

Hi veeam0n - Were you able to work out what happens? I too have Veeam running on PostgreSQL 15.x (installed as part of VBR12) have since upgraded to VBR13 and would like to upgrade to PostGreSQL 17.x

I’m thinking pg_upgrade might be needed as part of the process?


Link State
Forum|alt.badge.img+12
  • Author
  • Veeam Legend
  • January 24, 2026

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

 

I follow this step to upgrade to PostgreSQL 17.6-1. Completed successfully.

 

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

 

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

 

Because now I have both directories, C:\Program Files\PostgreSQL\15\BIN and C:\Program Files\PostgreSQL\17\BIN and running psql -V in each directory show different version respective to the parent directory.

Hi veeam0n - Were you able to work out what happens? I too have Veeam running on PostgreSQL 15.x (installed as part of VBR12) have since upgraded to VBR13 and would like to upgrade to PostGreSQL 17.x

I’m thinking pg_upgrade might be needed as part of the process?

Hi+ ​@CATS_Ade 

yes — pg_upgrade (or dump/restore) is mandatory for a major version change.

 

There are two ways to perform version migration of <DB Supported by Veeam:

Upgrading PostgreSQL in Windows · GitHub

Option 1: Manual PostgreSQL upgrades with pg_upgrade;

Stop all Veeam services.

Stop PostgreSQL 15.

Install PostgreSQL 17 side-by-side (do not remove 15 yet)

Run pg_upgrade

Start PostgreSQL 17

Repoint Veeam services (if required)

Validate Veeam functionality

Remove PostgreSQL 15 only after validation

 

Option 2: (Preferred): New PostgreSQL + Veeam configuration restore

https://helpcenter.veeam.com/docs/vbr/userguide/vbr_config_restore_hmc.html?ver=13 

 

regards


  • New Here
  • April 16, 2026

I have a PostgreSQL 15 (installed part of VBR12.3), and I then upgraded to VBR13. However the VBR upgrade process did not automatically upgraded database.

 

I follow this step to upgrade to PostgreSQL 17.6-1. Completed successfully.

 

In Control Panel> Program, I now have both PostgreSQL 15 and PostgreSQL 17 listed, should I uninstall PostgreSQL 15?

 

How do I verify that my VeeamBackup database is now running on PostgreSQL 17?

 

Because now I have both directories, C:\Program Files\PostgreSQL\15\BIN and C:\Program Files\PostgreSQL\17\BIN and running psql -V in each directory show different version respective to the parent directory.

Hi veeam0n - Were you able to work out what happens? I too have Veeam running on PostgreSQL 15.x (installed as part of VBR12) have since upgraded to VBR13 and would like to upgrade to PostGreSQL 17.x

I’m thinking pg_upgrade might be needed as part of the process?

Hi+ ​@CATS_Ade 

yes — pg_upgrade (or dump/restore) is mandatory for a major version change.

 

There are two ways to perform version migration of <DB Supported by Veeam:

Upgrading PostgreSQL in Windows · GitHub

Option 1: Manual PostgreSQL upgrades with pg_upgrade;

Stop all Veeam services.

Stop PostgreSQL 15.

Install PostgreSQL 17 side-by-side (do not remove 15 yet)

Run pg_upgrade

Start PostgreSQL 17

Repoint Veeam services (if required)

Validate Veeam functionality

Remove PostgreSQL 15 only after validation

 

Option 2: (Preferred): New PostgreSQL + Veeam configuration restore

https://helpcenter.veeam.com/docs/vbr/userguide/vbr_config_restore_hmc.html?ver=13 

 

regards

Thanks for the tips - Will try and report success (or otherwise!)


  • New Here
  • April 17, 2026

Here are my notes for my successful migration from 15 to 17 on a Windows server.

(Obviously, you may need to tweak for your environment)

Download latest PostgreSQL from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads 17.9 (as of 16/4/26)

Step 1 - Install PostgreSQL 17

Confirm current version running via elevated PowerShell:

cd 'C:\Program Files\PostgreSQL\15\bin\'

.\psql -V

Outputs

psql (PostgreSQL) 15.15

Install PostgreSQL 17 in an elevated PowerShell session:

.\postgresql-17.9-3-windows-x64.exe --mode unattended --disable-components stackbuilder

Confirm new version is running:

cd 'C:\Program Files\PostgreSQL\17\bin\'

.\psql -V

Step 2 - Backup current database

Establish details of current database connection using script from https://community.veeam.com/blogs-and-podcasts-57/upgrading-the-sql-database-engine-software-postgresql-used-by-veeam-backup-replication-9803:

Database Engine: PostgreSql
Connection Settings: localhost:5432
Database Name: VeeamBackup
PostgreSQL User: postgres

Ensure all Veeam jobs and tasks are stopped. Close the Veeam Backup and Replication console.

Stop all Veeam services with elevated PowerShell:

Get-Service Veeam* | Stop-Service -Force

Backup PostgreSQL database from elevated PowerShell using database name identified above:

cd "C:\Program Files\PostgreSQL\15\BIN"

.\pg_dump -U postgres -d "VeeamBackup" > C:\BackupPostgreSQL15\VeeamBackup.sql

Stop both PostgreSQL services:

Stop-Service -Name postgresql-x64-15

Stop-Service -Name postgresql-x64-17

Make a copy of the C:\Program Files\PostgreSQL\15 folder

Step 3 - Removed deprecated 'adminpack' extension

As the 'adminpack' extension is no longer supported in PostgreSQL 17 it must be removed.

Start the PostgreSQL 15 service.

From an elevated PowerShell session run:

cd 'C:\Program Files\PostgreSQL\15\bin\'

.\psql.exe -U postgres

Then, run the PostgreSQL command

DROP EXTENSION adminpack CASCADE;

Then stop the PostgreSQL 15 service again.

Step 4 - Migrate to new database

Create temporary working folder to be used by the pg_upgrade process. Grant everybody full access:

C:\temp_pgupgrade

Temporarily reconfigure authentication by editing {data_dir}/pg_hba.conf for both new and old installations:

Change

# IPv4 local connections:

host    all             all             127.0.0.1/32            sspi map=veeam

# IPv6 local connections:

host    all             all             ::1/128                 sspi map=veeam

to

# IPv4 local connections:

host    all             all             127.0.0.1/32            trust

# IPv6 local connections:

host    all             all             ::1/128                 trust

In an elevated PowerShell session, cd to the temp directory:

cd c:\temp_pgupgrade

and run

C:\Program` Files\PostgreSQL\17\bin\pg_upgrade.exe --old-datadir "C:\Program Files\PostgreSQL\15\data" --new-datadir "C:\Program Files\PostgreSQL\17\data" --old-bindir "C:\Program Files\PostgreSQL\15\bin" --new-bindir "C:\Program Files\PostgreSQL\17\bin" -U postgres

(Note the ` character in the path. Some users report issues if the space is not escaped like this)

When the command has completed, stop either of the PostgreSQL services if they have restarted.

In the C:\Program Files\PostgreSQL\17\data folder edit the following:

pg_hba.conf - Change all the METHOD entries to read 'sspi map=veeam'

pg_ident.conf - add the entries from the bottom of the '15' version of the same file (edit as required):

veeam   #####@#####   postgres

veeam   "SYSTEM@NT AUTHORITY"   postgres

postgresql.conf - Edit the port entry to be '5432' (or whatever the 15 version was set to).

Step 5 - Testing

Start the PostgreSQL 17 service.

Attempt to start the Veaam Backup Service. Assuming this starts, start the other Veeam services from an elevated PowerShell session:

Get-Service Veeam* | Start-Service

Open the Veaam Backup and Replication console and check it appears OK.

Step 6 - Clean up

Disable the old PostgreSQL 15 service

Delete the temporary directory c:\temp_pgupgrade used to execute pg_upgrade.

Reboot the server.

Step 7 - Finally

Uninstall PostgreSQL 15


Chris.Childerhose
Forum|alt.badge.img+21

Thanks for sharing your notes for the update.  It will definitely help others.