Backup and restore vCenter Server 6.x vPostgres database
search cancel

Backup and restore vCenter Server 6.x vPostgres database

book

Article ID: 316471

calendar_today

Updated On:

Products

VMware vCenter Server VMware vCenter Server 6.0

Issue/Introduction

This article provides guidance on backing up and restoring the embedded vPostgres database (VCDB) used by vCenter Server. This method can help prevent data loss when uninstalling vCenter Server, as the embedded database is removed during the uninstallation process.

Important Notes:

  • This method is not supported for vCenter Server 7.0 and 8.0.
  • This procedure is only supported for backing up and restoring the vPostgres database on the same vCenter Server instance. It is not intended for migrating the database to a different server or appliance.
  • For a full restore or secondary appliance recovery, utilize an image-based backup and restore approach.
  • vCenter Server Appliance also includes a native file-based backup and restore mechanism, which is the recommended method for protecting the vCenter Server. A backup of the vPostgres database is not required when using this supported file-based method.

For details on supported backup and restore options, refer to:

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

      • 6.0
        service-control --stop vmware-vpxd
        service-control --stop vmware-vdcs
    • Windows
      Open a command prompt, navigate to C:\"Program Files"\VMware\"vCenter Server"\bin

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

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

Steps

 

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

  • Video Overview



  • 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. SSH to the vCSA via root.
    2. Download the Linux backup and restore package 2091961_linux_backup_restore.zip attached to this Knowledge Base article.
    3. Make the backup_lin.py executable.

      chmod 700 /path_to_script/backup_lin.py

      Example

      chmod 700 /tmp/backup_lin.py

    4. Backup the VCDB.

      python /path_to_script/backup_lin.py -f /path_to_backup/backup_VCDB.bak

      Example

      python /tmp/backup_lin.py -f /tmp/backup_VCDB.bak

    5. When the backup completes, a message that the backup completed successfully appears.

  • Restore the vCenter Server Appliance vPostgres Database

    It may be required to move the database to a different vCenter Server Appliance VM 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).

    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. SSH to the vCSA via 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 destination vCSA.
    3. Make the restore_lin.py executable.

      chmod 700 /path_to_script/restore_lin.py

      Example

      chmod 700 /tmp/restore_lin.py

    4. Stop the vmware-vpxd and vmware-vdcs services.
      • 6.5 or later
        service-control --stop vmware-vpxd
        service-control --stop vmware-content-library

      • 6.0
        service-control --stop vmware-vpxd
        service-control --stop vmware-vdcs

    5. Run the restore_lin.py file and provide the location for the backup file.

      python /path_to_script/restore_lin.py -f /path_to_backup/backup_VCDB.bak

      Example
      python /tmp/restore_lin.py -f /tmp/backup_VCDB.bak

    6. When the restore completes, a message that the backup completed successfully appears.
    7. Start the vmware-vpxd and vmware-vdcs services.
      • 6.5 or later
        service-control --start vmware-vpxd
        service-control --start vmware-content-library

      • 6.0
        service-control --start vmware-vpxd

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

  • Video Overview



  • Back Up the Embedded vCenter Server Database (Windows)

    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 it on the vCenter Server.
      1. 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

        Example
        python.exe c:\backup_win.py -p "example_password" -f c:\backup_VCDB.bak
    5. When the backup completes, a message that the backup completed successfully appears.

  • Restoring the vCenter Server vPostgres Database (Windows)

    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:

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

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

    3. Open vcdb.properties in the %VMWARE_CFG_DIR%\vmware-vpx\ folder.
    4. In the vcdb.properties file, record the password for the vCenter Server database user.
    5. If not previously downloaded, download the Windows back up and restore package windows_backup_restore.zip attached to this KB article.
    6. Restore the VCDB

      python.exe c:\path_to_script/restore_win.py -p "password" -f c:\path_to_backup\backup_VCDB.bak

      Example
      python.exe c:estore_win.py -p "example_password" -f c:\backup_VCDB.bak

    7. When the restore completes, a message that the backup completed successfully appears.
    8. Start the vCenter Server and VMware Content Library services.

      From the 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

Additional Information

Attachments

2091961_windows_backup_restore.zip get_app
2091961_linux_backup_restore.zip get_app