A Quick Hack to Database Failure in vCenter Appliance
After playing with the vCenter appliance simulator feature documented by William, I got into a show stopper that vCenter service (VPXD) could not be started. I don’t think it’s related to the simulator feature at all. My guess is that it’s caused by a sudden power off of the virtual machine but didn’t try to reproduce the problem that way – I care more to fix it than anything else.
A quick Internet search got me the VMware KB article “VMware vCenter Server Appliance 5.0 GA with embedded DB2 database fails.” Knowing mine is 5.1 GA, I still tried to follow the steps there but couldn’t pass the second step due to invalid use name. I was not sure if the username is changed, or DB2 embedded is no longer used in the appliance. Update: from the print out messages in the vCenter appliance 5.1 console I found “vPostgres,” therefore I believe DB2 is no longer used in the appliance.
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
Somehow I remember there was a tag in the simulator setting related to database setting. So I checked the configuration file again:
There I did find it as shown below tagged as cleardb.
I was thinking if the database was corrupted cleaning the database might be able to fix the issue. Doing that would of course wipe out all the existing data. But I don’t care because the data was populated by the simulator and I don’t have any data I want to preserve as would in a production environment. All I care is to start the vCenter server. This may not be true for you. WARNING: If you want to keep your data, please stop here and contact VMware for help.
With that in mind, I changed the value of the cleardb to be true and restart the vpxd service with a single command line:
service vmware-vpxd restart
It took a bit longer than usual but it finally went through. To verify it, I opened the MOB and it seemed working just fine. Problem solved!
To make sure the simulator won’t waste time to clean DB each startup, I then changed the value of the cleardb tag back to false afterwards.
If the above hack doesn’t work for you, the last resort is to install a new vCenter appliance. That would surely solve your problem even though it may take a bit longer than this hack.
Again, it’s just a quick hack and not for anyone. Should you need to preserve database, try something else.