How to reindex the vCenter Appliance Database

The vCenter appliance has it’s own local database. Behind the scenes it is running a vPostgres to store information for the hosts and clusters it is manageing. Over time the database tables can become fragmented and impact performance. Always snapshot or backup your appliance before attempting this procedure. NOTE: This procedure is not currently supported by VMware. Use at your own risk. This has only been tested on vCenter 5.5 appliance. I will be testing older versions soon.

1. Login to vCenter and take a snapshot of your vCenter Appliance VM. If this is the only vCenter take note of the host the vCenter Appliance is currently running on. In case vCenter stops responding you may need to connect directly to the ESX host to revert the snapshot.

2. Login to the vCenter appliance as root or sudo to root and change directory to /opt/vmware/vpostgres/current/bin/

media_1411583928498.png

/opt/vmware/vpostgres/current/bin/

3. Type: ./reindexdb –dbname VCDB –username vc and press enter

media_1411584022365.png

./reindexdb --dbname VCDB --username vc

3.1 You should see a bunch of Notices like the following screen indicating which tables were reindexed. NOTE: It may take a minute or two.

media_1411584172346.png

4. If you want to run this on a regular schedule, create a shell named reindexvcdb.sh with the following lines and save it

media_1411584257318.png
cd /opt/vmware/vpostgres/current/bin/
./reindexdb --dbname VCDB --username vc

5. Use the following guide to add the reindexvcdb.sh file to the crontab

Remember sharing is caring!

2 Replies to “How to reindex the vCenter Appliance Database”

  1. Password is autogenerated during a VCSA Installation. You can find your password here in 6.5. shell: vi /etc/vmware-vpx/vcdb.properties

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.