Search the VMware Knowledge Base (KB)
View by Article ID

Back up and restore vCenter Server Appliance/vCenter Server 6.0 vPostgres database (2091961)

  • 41 Ratings
Language Editions

Details

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.  For more information on supported methods of backing up the vCenter Server Appliance, see the Backing Up and Restoring a vCenter Server Environment section of the vSphere Installation and Setup guide.

When you install vCenter Server, if you want to use the embedded vPostgres database and later have to uninstall vCenter Server, all data is lost, because the embedded vPostgres database is also 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.

Solution

Back Up the Embedded vCenter Server Database


Back up the embedded vCenter Server database to protect the data stored in your vPostgres database.

Prerequisite:

Create the folder in which you want to create the backup file and verify that you have read and write permissions on this folder.

Procedure:

  1. Log in as an administrator to the Windows host machine on which vCenter Server is installed.
  2. Locate the vcdb.properties file in the %VMWARE_CFG_DIR%\vmware-vpx\ folder and open the file using a text editor.
  3. In the vcdb.properties file, locate the password of the vc database user and record it.
  4. Download the Windows back up and restore package windows_backup_restore.zip attached to this KB article and unzip it on the Windows host machine.
  5. At the command prompt, navigate to %VMWARE_CIS_HOME%\Python\ and run the backup_win.py script, provide the password of the vc database user that you recorded in Step 3, and the location of the backup file.

    For example, if you want to save the file as C:\backup_VCDB.bak, run this command:

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


    Note: s_PJmbGzC83QRYlp is the password of the vc database user.
When the backup completes, you see a message that the backup completed successfully.

Restore the vCenter Server vPostgres Database

After you back up the embedded vPostgres database, you can restore it from a backup file.

Prerequisite:

Back up the vCenter Server vPostgres database.

Procedure:

  1. Log in as an administrator to the Windows host machine.
  2. Stop the vCenter Server and VMware Content Library services.

    1. From the Windows Start menu, navigate to Start > Administrative Tools > Services.
    2. Right-click VMware VirtualCenter Server and click Stop.
    3. Right-click VMware Content Library Service and click Stop.

  3. Locate the vcdb.properties file in the %VMWARE_CFG_DIR%\vmware-vpx\ folder and open the file using a text editor.
  4. In the vcdb.properties file, locate the password of the vc database user and record it.
  5. Download the Windows back up and restore package windows_backup_restore.zip attached to this Knowledge Base article and unzip it on the Windows host machine.
  6. At the command prompt, navigate to %VMWARE_CIS_HOME%\Python\ and run the restore_win.py script, provide the password of the vc database user that you recorded in Step 4, and the location of the backup file.

    For example, if you saved the backup file as C:\backup_VCDB.bak, run this command:

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

    Note: s_PJmbGzC83QRYlp is the password of the vc database user.

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

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

    1. From the Windows Start menu, navigate to Start > Administrative Tools > Services.
    2. Right-click VMware VirtualCenter Server and click Start.
    3. Right-click VMware Content Library Service and click Start.


Backing Up and Restoring the Embedded vCenter Server Appliance Database




Back up and restore the embedded vPostgres database as part of your regular vCenter Server Appliance database administration.

Back Up the Embedded vCenter Server Appliance Database

Back up the embedded vCenter Server Appliance database to protect the data stored in your vPostgres database.

Prerequisite:

Create the folder in which you want to create the backup file and verify that you have read and write permissions on this folder.

Procedure:

  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 a backup_lin.py executable.

    For example to save the file as /tmp/backup_lin.py , run this command:

    chmod 700 /tmp/backup_lin.py


  4. Run the backup_lin.py file and provide the location for the backup file.

    For example, if you want to save the file as /tmp/backup_VCDB.bak, run this command:

    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 copy the database to the new vCenter Server Appliance or Windows installed vCenter Server. 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).

Prerequisite:

Back up the vCenter Server Appliance embedded vPostgres database.

Procedure:

  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 a restore_lin.py executable, for example /tmp/restore_lin.py

    chmod 700 /tmp/restore_lin.py

  4. Stop the vmware-vpxd and vmware-vdcs services, by running these commands:

    service vmware-vpxd stop
    service vmware-vdcs stop

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

  6. Start the vmware-vpxd and vmware-vdcs services, by running these commands:

    service vmware-vpxd start
    service vmware-vdcs start

Additional Information

For translated versions of this article, see:

Attachments

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 41 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 41 Ratings
Actions
KB: