The Schwarrisons

KB0018 - Back up and restore vCenter Server Appliance vPostgres database

How to backup and restore the embedded vPostgres database for a VCSA appliance
KB0018 - Back up and restore vCenter Server Appliance vPostgres database

This article provides information for backing up and restoring the embedded vPostgres database for vCenter Server or vCenter Server Appliance. This process can be used when uninstalling the vCenter Server to prevent data loss due to the uninstalled database.

For versions before 6.x, see Backing up and restoring the vCenter Server Appliance 5.x vPostgres database.

Note:

Solution

Prerequisite:

  • Create a folder to store the backup and ensure read/write permissions are granted.
  • Stop the vmware-vpxd and vmware-vdcs services:

Appliance

6.7 and 6.5

service-control --stop vmware-vpxd

service-control --stop vmware-content-library

6.0 (Appliance):

service-control --stop vmware-vpxd service-control --stop vmware-vdcs

Windows

Open a command prompt, navigate to C:"Program Files"\VMware"vCenter Server"\bin and run the following commands:

6.7 and 6.5service-control --stop vpxd service-control --stop content-library

6.0service-control --stop vpxd service-control --stop vdcs

Backing Up and Restoring the Embedded vCenter Server Appliance Database

Back Up the Embedded vCenter Server Appliance Database

Caution: This procedure cannot be stopped. Stopping the script will cause inconsistencies in the vCenter Server appliance database and can prevent vCenter Server appliance from starting.

  1. Log in to the vCenter Server Appliance Linux console as root.
  2. Download the Linux backup and restore package 2091961_linux_backup_restore.zip attached to this Knowledge Base article.
  3. Make a backup_lin.py executable with this command: chmod 700 /*path_to_script*/backup_lin.pyFor example: chmod 700 /tmp/backup_lin.py
  4. Run this command: python /path_to_script/backup_lin.py -f /path_to_backup/backup_VCDB.bakFor example: python /tmp/backup_lin.py -f /tmp/backup_VCDB.bak

When the backup completes, you see a message that the backup completed successfully.

Restore the vCenter Server Appliance vPostgres Database

It may be required to move the database to a different vCenter Server Appliance VM or Windows installed vCenter Server provided it is the same vCenter Server instance as the backup source (e.g. a VM restored from backup or a clone of the existing VM). After you back up the embedded vPostgres database, you can restore it from the backup file.

Note: Using WinSCP on the vCenter Server Appliance may fail. For more information, see Error when uploading files to vCenter Server Appliance using WinSCP (2107727).

Caution: This procedure cannot be stopped. Stopping the script will cause inconsistencies in the vCenter Server appliance database and can prevent vCenter Server appliance from starting.

  1. Log in to the vCenter Server Appliance Linux console as root.
  2. Download the Linux backup and restore package 2091961_linux_backup_restore.zip attached to this Knowledge Base article and extract it on the Linux machine.
  3. Make restore_lin.py executable by running this commend: chmod 700 /path_to_script/restore_lin.pySFor example:chmod 700 /tmp/restore_lin.py
  4. Stop the vmware-vpxd and vmware-vdcs services, by running these commands depending on vCenter Server version:

6.7 and 6.5:

service-control --stop vmware-vpxd
service-control --stop vmware-content-library

6.0:

service-control --stop vmware-vpxd
service-control --stop vmware-vdcs
  1. Run the restore_lin.py file and provide the location for the backup file.For example, if the backup file is saved to /tmp/backup_VCDB.bak, run this command:python /tmp/restore_lin.py -f /tmp/backup_VCDB.bakWhen the restore completes, you see a message that the restore completed successfully.
  2. Start the vmware-vpxd and vmware-vdcs services by running:

6.7 and 6.5:

service-control --start vmware-vpxd
service-control --start vmware-content-library

For 6.0:

service-control --start vmware-vpxd
service-control --start vmware-vdcs
About the author
Stephen Schwetz

The Schwarrisons

Herping the derp!!

The Schwarrisons

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to The Schwarrisons.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.