Back up and restore vCenter Server Appliance/vCenter Server 6.x 7.0.x 8.0.x vPostgres database
search cancel

Back up and restore vCenter Server Appliance/vCenter Server 6.x 7.0.x 8.0.x vPostgres database

book

Article ID: 316471

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

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


Note:

  • This article is only supported for backup and restore of the vPostgres database to the same vCenter Server or vCenter Server Appliance. Use of image-based backup and restore is the only solution supported for performing a full, secondary appliance restore.
  • This KB article is specifically for backing up the vCenter database. Backing up and restoring your database protects the data stored in your database. The backup of the vPostgres database is not required when performing a backup using a supported method.
  • vCenter Server Appliance supports a native file-based backup and restore mechanism to recover the vCenter Server Appliance after failures. For more information on this, see:
 



Environment

VMware vCenter Server 6.0.x
VMware vCenter Server Appliance 6.0.x
VMware vCenter Server Appliance 6.7.x
VMware vCenter Server 6.5.x
VMware vCenter Server 7.0.x
VMware vCenter Server 6.7.x
VMware vCenter Server 8.0.x
VMware vCenter Server Appliance 6.5.x

Resolution

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.5:
service-control --stop vpxd
service-control --stop content-library


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

 

Backing Up and Restoring the Embedded vCenter Server Database (Windows)

Backing Up and Restoring the Embedded vCenter Server (Appliance) Database

 

Backing Up and Restoring the Embedded vCenter Server Database

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

  1. Log in as an administrator to the Windows host machine on which vCenter Server is installed.

  2. Open vcdb.properties in the %VMWARE_CFG_DIR%\vmware-vpx\ folder.

  3. In the vcdb.properties file, record the password for the vCenter Server database user.

  4. Download the attached Windows back up and restore package windows_backup_restore.zip attached to this KB article and extract is on the vCenter Server.

  5. From the command prompt run the command using the password from step 3: python.exe c:\path_to_script\backup_win.py -p "password" -f c:\path_to_backup_folder\backup_VCDB.bak

    For example:

    python.exe c:\backup_win.py -p "s_PJmbGzC83QRYlp" -f c:\backup_VCDB.bak

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

Restoring the vCenter Server vPostgres Database

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

  1. Log in as an administrator to the Windows host machine.

  2. Stop the vCenter Server and VMware Content Library services.

From a windows command prompt navigate to C:\"Program Files"\VMware\"vCenter Server"\bin and run the following commands depending on vCenter Server version:

6.7 and 6.5:
.\service-control --stop vpxd
.\service-control --stop content-library


6.0:
.\service-control --stop vpxd
.\service-control --stop vdcs

  1. Open vcdb.properties in the %VMWARE_CFG_DIR%\vmware-vpx\ folder.

  2. In the vcdb.properties file, record the password for the vCenter Server database user.

  3. If not previously downloaded, download the Windows back up and restore package windows_backup_restore.zip attached to this KB article.

  4. From the command prompt, run this command using the password from step 3: python.exe c:\path_to_script/restore_win.py -p "password" -f c:\path_to_backup\backup_VCDB.bak

    For example:

    python.exe c:\restore_win.py -p "s_PJmbGzC83QRYlp" -f c:\backup_VCDB.bak

    Once the restore completes, you see a message that the restore completed successfully.

  5. Start the vCenter Server and VMware Content Library services.

From windows command prompt navigate to C:\"Program Files"\VMware\"vCenter Server"\bin and then run the following commands:

6.7 and 6.5:
.\service-control --start vpxd
.\service-control --start content-library


6.0:
.\service-control --start vpxd
.\service-control --start 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.py

    For example:
    chmod 700 /tmp/backup_lin.py

  4. Run this command: python /path_to_script/backup_lin.py -f /path_to_backup/backup_VCDB.bak

    For 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 Connecting to vCenter Server Virtual Appliance using WinSCP fails with the error: Received too large (1433299822 B) SFTP packet. Max supported packet size is 1024000 B



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 command: chmod 700 /path_to_script/restore_lin.py

    SFor 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.bak

    When 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

Additional Information

Attachments

2091961_windows_backup_restore.zip get_app
2091961_linux_backup_restore.zip get_app