Restore VCSA Postgres Database

Before diving into data extraction, it’s essential to understand the anatomy of a typical vCSA backup:

  • Backups are usually stored on a network share.

  • The top-level folder of the network share will have a folder named 'vCenter'.

  • Inside the 'vCenter' folder, you will find separate folders for each vCenter instance being backed up to the network share.

  • Each vCenter folder contains subfolders for individual backup runs. These subfolders are named using the following convention: an initial letter ('M' for manually created or 'S' for scheduled backups), followed by the vCenter version, and ending with a timestamp.

  • Inside these subfolders, you’ll find various files related to different vCSA components. For our purposes, we need specific files to restore the internal PostgreSQL database.


Restore using Docker Container

Prerequisites

From the VCSA backup we need the following files to restore the Postgres database:

  • database_full_backup.tar.gz

  • wal_backup_*.tar.gz

  • wal_dir_struct.tar.gz

If the database is password protected you'll usually find the password in the archive file config_files.tar.gz, at etc/vmware-vpx/vcdb.properties, root/.pgpass or etc/vmware-vpx/embedded_db.cfg.

Setup container structure

Access the database container

As noted earlier login credentails can be found in config_files.tar.gz, /etc/vmware-vpx/vcdb.properties, root/.pgpass or /etc/vmware-vpx/embedded_db.cfg.

Access the database: sudo docker exec -it vcsa_recovery_db psql -U vc VCDB

Useful Queries:

Last updated

Was this helpful?