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

|
Purging samples before upgrading to a newer version of VMware vCenter Chargeback (1026068)
Purpose
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
Resolution
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:
-
Stop all Chargeback services. This includes:
-
Load Balancer
-
vCenter Chargeback
-
Data Collector
-
-
Backup the Chargeback database and all application-related files. For more information, see Backing up a vCenter Chargeback database and configuration files (1026796).
-
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.
-
- 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:
DBCC SHRINKDATABASE ($databaseName, TRUNCATEONLY)
- For an Oracle database, run the scripts documented by Oracle.
- In SQL Server, run this command to shrink the data file and the log file:
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
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):

