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

Back up and restore vCenter Server Appliance/vCenter Server 6.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:
 


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

For translated versions of this article, see:

Additional Information

VMware Skyline Health Diagnostics for vSphere - FAQ
Enabling secure backup and restore in the vCenter Server Appliance

Attachments

2091961_windows_backup_restore.zip get_app
2091961_linux_backup_restore.zip get_app