Search the VMware Knowledge Base (KB)
View by Article ID

Shrinking the size of the VMware vCenter Server SQL database (1036738)

  • 13 Ratings

Purpose

This article provides the query to shrink the size of the vCenter Server SQL database and transaction logs.
 
You can shrink the size of the SQL database and transaction logs when:
  • The vSphere Client takes a long time to open the vCenter Server connection.
  • vCenter Server service crashes unexpectedly.
  • vCenter Server tasks are very slow to respond.
  • The database server used for vCenter Server has run out of disk space.
  • You see that the SQL VIM_VCDB size is 300% more than the estimated database size.

Resolution

To shrink the size of the vCenter Server SQL database and transaction logs:
  1. Connect to the vCenter Server database using the SQL Management Studio Express as an administrator.
  2. Stop the VMware VirtualCenter Server service.
  3. Take a backup of the vCenter Server database using this query:

    BACKUP DATABASE DatabaseName TO DISK = 'C:\DatabaseName.BAK'
    GO

  4. Right-click the vCenter Server database, click Run Query, and run this query :

    DBCC SHRINKDATABASE ( DatabaseName , 5);
    GO

  5. Start the VMware VirtualCenter Server service.

Note: When DBCC SHRINKDATABASE is specified with target_percent, the Database Engine calculates the target size to be the target_percent amount of space free in the file after shrinking.

If you are unable to shrink the size of the vCenter Server database (VIM_VCDB) using the SQL Management Studio GUI, you have to run T-SQL scripts.



Additional Information

For more information on using DBCC SHRINKDATABASE, see the Microsoft Knowledge Base article190488

Note: The preceding link was correct as of July 21, 2014. If you find the link is broken, provide feedback and a VMware employee will update the link.

To check the status of the
database shrink, run this query:
 
SELECT percent_complete, start_time, status, command, estimated_completion_time, cpu_time, total_elapsed_time, * FROM sys.dm_exec_requests

Tags

database-transaction-logs vCenter-Database-Health vcenter-database-size-growth

See Also

Update History

07/-2/2012 - Added SQL query to check status of shrink.

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 13 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 13 Ratings
Actions
KB: