Knowledge Base
The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides

|
Purging old data from the database used by vCenter Server (1025914)
Symptoms
- The vCenter Server service starts, but eventually crashes.
- The transaction logs are working correctly.
- You may notice excessive growth of the
VPX_EVENTtable, and this error message in the Microsoft SQL Event log:Could not allocate space for object 'dbo.VPX_EVENT'.'VPXI_EVENT_USERNAME' in database 'VCDB' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
- Viewing the data Disk usage by tables report shows the
VPX_EVENTandVPX_EVENT_ARGtables utilizing the maximum space. - None of these troubleshooting steps resolve this issue:
- Purging the old data
- Truncating tables
- Shrinking the logs and database
- Re-creating Roll up jobs
Purpose
vCenter Server has a Database Retention Policy setting that allows you to specify when vCenter Server tasks and events should be deleted. Since this setting does not affect performance data records, it is still possible to purge or shrink old records from the database using the scripts attached to this article.
To access the Database Retention Policy setting in the vSphere Client:
Click Administration > vCenter Server Settings > Database Retention Policy.The scripts attached to this article support purging the performance data from vCenter Server.
Caution: Do not run the scripts attached to this article against a Virtual Center 2.x database. For information about purging data in Virtual Center 2.x, see Purging old data from the database used by VirtualCenter 2.x (1000125).
Note: SQL Express 2005/2008 (vCenter Server 5.x has SQL Express 2008 as the bundled edition) supports a maximum of 5 hosts and 50 virtual machines. If your environment exceeds this threshold, you must upgrade your database to SQL Standard.
Resolution
Note: This video was originally created for Knowledge Base article 1000125. However, the steps can be used for this article as well.
Caution: The scripts attached to this article are intended for execution by database administrators (DBAs) who are experienced with using database client tools to execute SQL commands. The purpose of the scripts is to delete data. VMware strongly recommends that you stop the vCenter Server service and make a full, reliable backup of your database before attempting this process.
Notes:
- For 5.1, please see the section titled: To truncate all performance data from vCenter Server 5.1 in Reducing the size of the vCenter Server database when the rollup scripts take a long time to run (1007453)
- If you are using SQL 2005 Express, you may need to download and install Microsoft SQL Server Management Studio Express.
- If you are unable to download the scripts attached to this article, please contact VMware Support. For more information, see How to Submit a Support Request.
The database transaction log may fill up during this procedure if sufficient disk space is not available. For SQL Server, if the required disk space cannot be made available, one option is to utilize the "simple" recovery model on the database for the duration of this operation.
Warning: The VirtualCenter Server service must be stopped while the script is running. For more information, see Stopping, starting, or restarting vCenter services (1003895).
Notes:
- If the database is very large it may take a very long time to run this script. Running the script increments by changing the default cutoff days of 180 which represents 6 months. For example, assuming you have one year of data (365 days) you can increase this to a larger value such as 330 at first, and this will purge only about one month of data. You can then run the script with a cutoff date set to 300 to purge another month of data.
- If the scripts fail to run because of a lack of available database space, you may need to truncate your performance data. If you want to truncate all performance data instead of purging it, see Reducing the size of the vCenter Server database when the rollup scripts take a long time to run (1007453)
- If the database has reached a 4 GB limit in SQL Express, the database is corrupted, or if vCenter Server is unavailable for any reason, purge the
eventandevent_argtables either by manually enabling the database retention policy in the database using SQL Studio, or by running the stored procedure to purge the data from these tables. - The vCenter Server database is usually named
VIM_VCDB, unless is was renamed during initial creation. - To truncate the data in the
VPX_EVENTtable:
- Connect to
Servername\SQL Databaseand log in with the appropriate credentials. - Expand databases > VIM_VCDB > Tables.
- Right-click the dbo.VPX_PARAMETER table and click Open.
- Modify event.maxAge to 30, and modify the event.maxAgeEnabled value to true.
- Modify task.maxAge to 30, and modify the task.maxAgeEnabled value to true.
- Run the built-in stored procedure:
- Navigate to VIM_VCDB > Programmability > Stored Procedures.
- Right-click dbo.cleanup_events_tasks_proc and click Execute Stored Procedure.
This purges the data from thevpx_event,vpx_event_arg, andvpx_tasktables based on the date specified for maxAge.
- When this has successfully completed, close SQL Management Studio and start the VMware Virtual Center Server service.
- Connect to
- Using the vSphere Client, log into vCenter Server as an administrator.
- Navigate to Administrator > vCenter Server Settings > Statistics.
- Under Statistics Intervals, ensure the Statistics Level column is set to 1.
- To change the value, select the Interval Duration, click Edit and select Level 1 from the dropdown.
- The execution of
dbo.cleanup_events_tasks_procmight take a long period of time depending on the database size. - It may fail due to the transaction logs being filled up at multiple intervals based on the data to be purged. You must shrink the Transaction logs when required and run
dbo.cleanup_events_tasks_procagain.
Additional Information
For IBM DB2 databases, see Reorganizing the database. Engage your database administrator to perform any required changes.
For further assistance, file a support request with VMware Technical Support and note this Knowledge Base article ID (1025914) in the problem description. For more information, see Filing a Support Request in My VMware (2006985).
Note: When the vCenter Database has been purged, you may notice an improvement in the performance of the vSphere Client connected to the vCenter Server.
Note: The external links in this article were correct as of November 20, 2012. If you find a link is broken, provide feedback and a VMware employee will update the link.
For translated versions of this article, see:
- Español: Depurando la base de datos usada por vCenter Server (1034673)
- Português: Como limpar dados antigos do banco de dados usado pelo vCenter Server (2037293)
- 日本語: vCenter Serverで使用しているデータベースから古いデータのパージについて (2014792)
The attached Oracle script works up to vCenter Server version 5.0
See Also
- Purging old data from the database used by VirtualCenter 2.x
- Stopping, starting, or restarting vCenter services
- Troubleshooting transaction logs on a Microsoft SQL database server
- Reducing the size of the vCenter Server database when the rollup scripts take a long time to run
- Depurando la base de datos usada por vCenter Server
- Filing a Support Request in My VMware
- vCenter Serverで使用しているデータベースから古いデータのパージについて
- Como limpar dados antigos do banco de dados usado pelo vCenter Server
Update History
Attachments
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.
Actions
KB:
- Updated:
- Categories:
- Languages:
- Product Family:
- Product(s):
- Product Version(s):

