Validate the Consistency of the vCenter Server Appliance 6.5 and Newer Databases
search cancel

Validate the Consistency of the vCenter Server Appliance 6.5 and Newer Databases


Article ID: 323923


Updated On:


VMware vCenter Server


The script, located under the Attachments section on the bottom of the article, performs a number of functions with it's primary function being a check of the selected database to ensure that all data can be read.  
By reading out all of the data from the database we can verify that there are no issues present that will impede the operation of the database.

Along with checking the read consistency of the selected database(s) the script also does the following:

  • Backup selected database(s)
  • Vacuum the PostgreSQL database
  • Send an e-mail notification of the results of the selected operation(s)
  • Correct issue with Crontab to allow for the addition of this script to Crontab
  • Test SMTP settings to ensure e-mails will be received


  • VMware vCenter Server 7.0.x
  • VMware vCenter Server Appliance 6.7.x
  • VMware vCenter Server Appliance 6.5.x


Configuration of the Script

  1. Log into the vCenter Server Appliance as root via SSH or Console.Toggling the vCenter Server Appliance 6.x default shell
  2. Make a directory for the script:
mkdir /scripts/
  1. Copy the script to the vCenter Server Appliance under /scripts using an SCP utility.
  2. Verify the script has proper rights:
chmod 744 /scripts/

(Optional): Configure SMTP to allow script to send e-mail notifications

  1. Follow the directions in the VMware Documentation to configure SMTP on your vCenter Server Appliance.
  2. Log into the vCenter Server Appliance as root via SSH or Console.
  3. Test SMTP functionality by running the following:
/scripts/ -e e-mail -s
Note: Replace e-mail with the desired destination e-mail address

(Optional): Configure script to be run by Cron

  1. Log into the vCenter Server Appliance as root via SSH or Console.
  2. Then type shell.
  3. Enable Crontab functionality:
/scripts/ -c
  1. Add the script to Crontab:
crontab -e
  1. Type i to insert into file.
  2. Copy the following into the file.
00 02 * * * /scripts/ Options

Note: Replace Options with the desired script options found in the Additional Information section of this article..
  1. Type :wq and press the Enter key to write the changes and close the file.
Note: The Crontab time format is Minutes Hour Day_of_the_Month Month Day_of_the_Week
Example: 00 02 * * * would run the script at 02:00 AM system time everyday of the month.

Execution of the Script

There are a number of options that can be simultaneously run.  
For instance, you can check the AFD and PostgreSQL databases, backup both databases to a defined location, and vacuum the PostgreSQL database.  

Example/scripts/ -a -b -f /tmp/ -v
Note: In the above example; any errors will be reported to /var/log/vmware/vpostgres/VPG_Check-date/time_error.log.

The suggested execution of this script is:
/scripts/ -a -b -f /location -v -e e-mail_address

Note: Replace location with the desired backup location and e-mail_address with the desired e-mail address.
In the above example; script messaging will be recorded to the default log file and an e-mail notification reflecting the status will be sent to the defined address.

  • By default every execution of the script creates a /var/log/vmware/vpostgres/VPG_Check-date/time_error.log file.
  • When executing a backup of any database the script will ensure there is at least 10% of available disk space on the destination defined.  If there is not 10% free space the script will error out reporting this.

Additional Information

Script Options:
-a enable backup of AFD
-b enable backup of VCDB
-f backup file location
-v vacuum VCDB DB
-e notify e-mail address
-s test SMTP (Requires -e option)
-c correct Crontab issue
-h help


vpgsql-consistency-check get_app