Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Reducing the size of the vCenter Server database when the rollup scripts take a long time to run (1007453)

Symptoms

Some of these symptoms may be encountered when the rollup jobs are running very slowly as a result of the vCenter Server database size:
  • The vCenter Server database is very large (50 GB or more) and the row count in the VPX_HIST_STAT tables is very high (800 million lines or more).
  • Rollup scripts are running very slowly or may not complete successfully.
  • Performance Charts may not display recent data.
  • Gaps are appearing in the Performance Charts.
  • When this issue is encountered, you may see this message in the Windows Event Viewer on vCenter Server:

    Stats insertion failed for entity esxhost.domain.com due to ODBC error

Purpose

This article provides steps to reduce the size of the vCenter Server database if the database rollup scripts take a long time to run.

Cause

One possible cause of the performance data growing so large may be the stats collection level setting. Verify the current stats collection level, and if this is set to a collection level higher than 2, then this should be set back to a lower stats collection level of 1.

Resolution

If the vCenter Server database is very large (50 GB or more) and the row count in the VPX_HIST_STAT# table is very high (800 million lines or more), the database rollup scripts may have difficulty handling the amount of data. Rollup scripts run faster if you reduce the size of the vCenter Server database.

Before you reduce the size of the vCenter Server database, you may want to defragment the indexes on your Microsoft SQL database server. For more information, see Defragmenting VirtualCenter performance data indexes on a Microsoft SQL database (1003990).
 

Reducing the size of the vCenter Server database

To reduce the size of the vCenter Server database:
 
Warning: This procedure erases all historical data. If you want to retain some historical performance data instead of deleting all of it, see Purging old data from the database used by vCenter Server (1025914) or Purging old data from the database used by VirtualCenter 2.x (1000125).

Note: The below steps are not applicable to vCenter Server 5.1 and 5.5. To truncate performance data on the vCenter Server 5.1 and 5.5 database see the following section, To truncate all performance data from vCenter Server 5.1.

  1. Ensure that you have a good backup of the vCenter Server database. Do not skip this step.

  2. Shut down the VMware VirtualCenter Server service and any other services (such as VMware VDI or VMware Lab Manager) that use the database. For more information, see Stopping, starting, or restarting vCenter services (1003895).

    Note: Again, ensure that you have a recent backup of the vCenter Server database before continuing. Do not skip this step.

  3. Truncate the VPX_HIST_STAT1 table and corresponding VPX_SAMPLE_TIME1 table. Once the truncate has completed, verify if the rollup jobs are now completing successfully. For more information, see step 4.

    Warning: The truncate function is destructive. VMware highly recommends that a Database Administrator perform this step.

    To truncate the tables, execute these SQL statements:

    truncate table VPX_HIST_STAT1;

    Note: In vCenter Server 5.1and 5.5, the table name is VPX_HIST_STAT1_n.

    truncate table VPX_SAMPLE_TIME1;

    Note
    : To reduce the size of vCenter Server Database, you can also delete the data from the VPX_EVENT, VPX_EVENT_ARG, and VPX_TASK tables. To delete the data from these tables, see Purging old data from the database used by vCenter Server (1025914) or Purging old data from the database used by VirtualCenter 2.x (1000125).

    If the rollup jobs do not complete successfully, it may be necessary to truncate the VPX_HIST_STAT2 table, and the corresponding table, VPX_SAMPLE_TIME2. Continue truncating the VPX_HIST_STAT[1-4] tables and corresponding VPX_SAMPLE_TIME[1-4] tables until the rollup jobs are completing successfully.

    Note: These additional tables in vCenter Server 4.1 and 5.0 can also be truncated to further reduce the vCenter Server database size. The VPX_TEMPTABLEx tables are a staging/cache area for the performance data before they are processed and moved to VPX_HIST_STAT1.

    truncate table VPX_TEMPTABLE0;
    truncate table VPX_TEMPTABLE1;
    truncate table VPX_TEMPTABLE2;


  4. Run the rollup scripts using these steps:

    1. Using SQL Management Studio, connect to the SQL database for vCenter Server.
    2. Navigate to SQL Server Agent > Jobs.
    3. Select the individual rollup jobs, right-click and select Start Job at Step.

  5. Start the VMware VirtualCenter Server service and any other service service that you stopped in step 2.


Truncating all performance data from vCenter Server 5.1 and 5.5

To truncate all performance data from vCenter Server 5.1 and 5.5:
 
Warning: This procedure permanently removes all historical performance data. Ensure to take a backup of the database/schema before proceeding.
  1. Stop the VMware VirtualCenter Server service. For more information, see Stopping, starting, or restarting vCenter services (1003895).

    Note: Ensure that you have a recent backup of the vCenter Server database before continuing. Do not skip this step.

  2. Log in to the vCenter Server database using SQL*Plus (for Oracle) or SQL Management Studio (for SQL Server).
  3. Copy and paste the contents of the Oracle_truncate_5.x.sql  script attached to this article into SQL*Plus. Alternatively, for SQL Server, copy and paste the contents of the SQL_truncate_5.x.sql  script into SQL Management Studio.
  4. Execute the script to delete the data.
  5. Restart the vCenter Server services.

Additional Information


Note: The links in this article were correct as of January 25, 2013. If you find a link is broken, provide feedback and a VMware employee will update the link.

Tags

shrinking-database database-transaction-logs

See Also

Update History

02/27/2013 - Added procedure to truncate all performance data from vCenter Server 5.1 03/05/2013 - Added note about the VPX_HIST_STAT1_n table name in vCenter Server 5.1

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.

Feedback

  • 72 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)
  • 72 Ratings
Actions
KB: