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

Purging samples before upgrading to a newer version of VMware vCenter Chargeback (1026068)

  • 0 Ratings


Before upgrading your vCenter Chargeback installation to vCenter Chargeback 1.5, it is necessary to purge the non-daily samples from the performance stats table in the database, as they are not used for cost calculation. This also ensures that the database size is not too large due to storing data that is no longer used, helping to optimize both database and vCenter Chargeback performance.
Failing to purge these samples increases the probability of errors being logged during the upgrade process, because the data in the stats table is used while making changes to the vCenter Chargeback database during the upgrade. Failure to purge these samples can also greatly increase the time required to upgrade, due to the inflated size of the performance stats table. This can even lead to the upgrade failing.
This article provides the steps to purge those samples.
NOTE: Do not run the purge scripts if you are currently using vCenter Chargeback 1.5 or later and upgrading the setup to a later release of vCenter Chargeback


VMware vCenter Chargeback includes a script that deletes the non-daily samples which are not used for cost calculation, but retains the samples for short-lived (less than a day) virtual machines.
To delete the appropriate samples:
  1. Stop all Chargeback services. This includes:
    • Load Balancer
    • vCenter Chargeback
    • Data Collector

    Note: For information, see the vCenter Chargeback User's Guide.

  2. Backup the Chargeback database and all application-related files. For more information, see Backing up a vCenter Chargeback database and configuration files (1026796).

  3. Download and run the appropriate database script.
    • If the Chargeback database is on a SQL server, use this script: purgeSamples_mssql.sql
    • If the Chargeback database is on an Oracle server, use this script: purgeSamples_oracle.sql

      Note: The MSSQL and Oracle scripts are optimized for large databases, and the purging works in batches. The default batch size is 1 million. The batch size can be changed by setting the desired value for the @block_size parameter in the MSSQL script and the v_block_size parameter in the Oracle script.

  4. Follow the steps specific to your database to shrink the size of the database-related file.
    • In SQL Server, run this command to shrink the data file and the log file:


    • For an Oracle database, run the scripts documented by Oracle.

Additional Information

Performing this process can take a significant amount of time, depending on the complexity of your environment. Ensure that you plan for adequate down time before executing the above procedure.

See Also

Update History

09/01/2010 - Added step to shrink the database. 11/18/2011 - Attached updated scripts 03/27/2012 - Linked article 1026796. Title change.


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.


  • 0 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.
  • 0 Ratings