VMware
 

Knowledge Base

Search the Knowledge Base:

Products:
Search In:
 

Purging old data from the database used by vCenter Server

Details

vCenter Server stores tasks, event, and performance data in the vCenter database. Over time, data collection results in growth of the database files and a mechanism is needed to shrink these files.
 
In VirtualCenter 2.0.x and vCenter Server 2.5.x there is no feature in the product itself to purge or shrink old records from the database, but it is possible to manually shrink the VirtualCenter database using the scripts attached to this article.

In vCenter Server 4.0.x there is a Database Retention Policy setting which 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.

 

There are two variations of this solution, one for each of the supported vCenter database platforms, Oracle and Microsoft SQL Server.
 
The attached scripts support purging the data from VirtualCenter 2.0.x, vCenter Server 2.5.x and vCenter Server 4.0.x.
 
Note: The Oracle version of the scripts are not combined. When you extract the scripts, run the version of the script for the version of vCenter that is in use.

Solution

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 VirtualCenter Server service and make a full, reliable backup of your database before attempting this process.

 

These scripts delete rows, in batches, from designated tables in the vCenter database. However, by default it only reports how many rows are deleted. To actually delete data, a configuration parameter within the script must be modified. This is a safety precaution. Please see the comments in the heading of the script for details. Diagnostic messages are printed that summarize the operations.

 

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 this script is running. For more information, see Stopping, starting, or restarting vCenter services (1003895).

 
The SQL Server solution consists of one SQL script that can delete tasks, events, and performance data. Simply comment or delete the applicable section of the script if any of these items are not to be purged.
 
The Oracle solution consists of three separate SQL scripts, one for purging each type of data. Administrators may decide to use one, two, or all three scripts depending on data purging requirements.

Attachments

Feedback

Rating: 1 - Lowest 2 3 4 5 - Highest (28 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? (2000 or fewer characters)
Submit
Rating: 1 - Lowest 2 3 4 5 - Highest (28 Ratings)   
Actions