Friday, June 8, 2012

vSphere Client won't connect to vCenter?

I have run into this issue with multiple customers that have VMware vSphere 4+ and Microsoft SQL Server 2005 Express Edition. Many times when working with vSphere, rather than installing SQL Server Standard/Enterprise Edition, customers typically install SQL Server Express since it comes as an installable option with the vSphere .msi. Is this a good idea? NOPE. There is a 4GB limit to SQL Server Express Edition. This is a total pain because one day, without warning, you will attempt to log into vCenter via your vSphere client only to be greeted by an error stating that the vSphere client is unable to connect to the vCenter server. Looking in services.msc will reveal that the VMware VirtualCenter Server service has stopped, and attempting to restart the service fails.

There are multiple ways to free up space. Obviously, the best thing to do would be to migrate to Microsoft SQL Server Standard or Express Edition. However, if you are in a bind and just need to get into VMware vSphere, follow the steps below:

Check Database Size:

  • Login to the vCenter server.
  • Stop all vCenter services.
  • Launch Microsoft SQL Server Management Studio Express. You can download Management Studio if you do not have it.
  • Under Server Name select the database that pertains to your vCenter instance. Chances are you are only using the server to host vCenter so there may only be one database to select.
  • Under Authentication you can select Windows Authentication and click connect. Assuming you are logged in as an administrator you should be able to connect without issue.
  • Click connect.
  • Before you do anything, you want to verify that a full database is your issue. Right-click on VIM_VCDB and select properties. Under properties you will see how much space is in use.
Modify Events and Tasks Parameters:
  • Expand the database as shown below until you see a table called dbo.VPX_PARAMETER.
  • Right-click on dbo.VPX_PARAMETER and select Open Table
  • Modify the following values:
    • event.maxAge - By default this is set to 180 days. You can set this to whatever you desire. Obviously if you decrease the amount, the less will be retained.
    • event.maxAgeEnabled - By default this is set to false, which means that by default your database saves all events. Make sure this is set to true.
      • Do the same thing for the task.maxAge and task.maxAgeEnabled values.
Execute Database Cleanup:
  • Expand the database as shown below until you see a table called dbo.cleanup_events_tasks_proc.
  • Right-click on dbo.cleanup_events_tasks_proc and select Execute Stored Procedure.
  • This will remove all the events and tasks that do not match the parameters specified in the dbo.VPX_PARAMETER table. This may take a few minutes.
  • Once complete, open up the database properties again and check the database size. It should be substantially lower. 


No comments:

Post a Comment