Vmware VCSA DB Operations
WinSCP
This solution does not required any configuration in vCenter Appliance side. From “WinSCP” Client. Choose “SFTP” File protocol from drop down and enter vCenter credentials -> Click “Advanced” Button ->in Advance Site Settings-> Under “Environment -> SFTP -> In “Protocol options” Section -> Enter below command in “SFTP Server” settings. shell /usr/lib64/ssh/sftp-server
shell.set --enable True shell chsh -s /bin/bash root chsh -s /bin/appliancesh root
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.
Stop the vmware-vpxd and vmware-vdcs services, by running these commands depending on vCenter
Server version:
For 6.7 and 6.5 (Appliance):
service-control –stop vmware-vpxd
service-control –stop vmware-content-library
For 6.0 (Appliance):
service-control –stop vmware-vpxd
service-control –stop vmware-vdcs
From Windows command prompt navigate to C:\”Program Files”\VMware\”vCenter Server”\bin and run the following commands depending on vCenter Server version:
For 6.7 and 6.5 (Windows):
service-control –stop vpxd
service-control –stop content-library
For 6.0 (Windows):
service-control –stop vpxd
service-control –stop vdcs
Procedure:
Caution: This procedure cannot be stopped. Stopping the script will cause inconsistencies in the vCenter Server database and can prevent vCenter Server from starting.
Log in as an administrator to the Windows host machine on which vCenter Server is installed.
Locate the vcdb.properties file in the %VMWARE_CFG_DIR%\vmware-vpx\ folder and open the file using a text editor.
In the vcdb.properties file, locate the password of the vc database user and record it.
Download the Windows back up and restore package windows_backup_restore.zip attached to this KB article available at the right hand side of the Knowledge Base webpage and unzip it on the Windows host machine.
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:
Caution: This procedure cannot be stopped. Stopping the script will cause inconsistencies in the vCenter Server database and can prevent vCenter Server from starting.
Log in as an administrator to the Windows host machine.
Stop the vCenter Server and VMware Content Library services.
From windows command prompt navigate to C:\”Program Files”\VMware\”vCenter Server”\bin and run the following commands depending on vCenter Server version:
For 6.7 and 6.5:
.\service-control –stop vpxd
.\service-control –stop content-library
For 6.0:
.\service-control –stop vpxd
.\service-control –stop vdcs
Locate the vcdb.properties file in the %VMWARE_CFG_DIR%\vmware-vpx\ folder and open the file using a text editor.
In the vcdb.properties file, locate the password of the vc database user and record it.
Download the Windows back up and restore package windows_backup_restore.zip attached to this Knowledge Base article available at the right hand side of the webpage and unzip it on the Windows host machine.
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.
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 depending on vCenter Server version:
For 6.7 and 6.5:
.\service-control –start vpxd
.\service-control –start content-library
For 6.0:
.\service-control –start vpxd
.\service-control –start vdcs
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:
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.
Log in to the vCenter Server Appliance Linux console as root.
Download the Linux backup and restore package 2091961_linux_backup_restore.zip attached to this Knowledge Base article available at the right hand side of the web page and extract it on the Linux machine.
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
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:
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.
Log in to the vCenter Server Appliance Linux console as root.
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.
Make a restore_lin.py executable, for example /tmp/restore_lin.py
chmod 700 /tmp/restore_lin.py
Stop the vmware-vpxd and vmware-vdcs services, by running these commands depending on vCenter Server version:
For 6.7 and 6.5:
service-control –stop vmware-vpxd
service-control –stop vmware-content-library
For 6.0:
service-control –stop vmware-vpxd
service-control –stop vmware-vdcs
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.
Start the vmware-vpxd and vmware-vdcs services, by running these commands depending on vCenter Server version:
For 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
Attachments
2091961_linux_backup_restore.zip
2091961_windows_backup_restore.zip
Backing Up and Restoring the Embedded vCenter Server Appliance Database
2091961_linux_backup_restore (1)
https://kb.vmware.com/s/article/2091961