Badges

gestaltitbadge

follow-me-twitter

Subscribe to me on FriendFeed

Comments / DISQUS
Feedjit.com

Script to clean up Virtual Center database

I was directed to a VMware Knowledge Base article about a script for cleaning up the VC database while upgrading to VC2.5. The company had about 18 months worth of data in their VC SQL database and wanted to preserve some recent historical data, but didn’t need to keep all of it. Purging data helped free disk space and reduce the time the upgrade actually took to complete.

The VMware article links to scripts for both


SQL and Oracle databases. From the KB article:

The scripts attached to this KB article are intended for database administrators (DBAs) that are experienced with using database client tools to execute SQL commands. The purpose of this script is to delete data. You are strongly advised to stop the VirtualCenter Server service and make a full, reliable backup of your database before attempting this process.

These scripts will delete rows, in batches, from designated tables in the VirtualCenter DB. However, by default it will only report how many rows would be 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 will be 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 to consider is to utilize the “simple” recovery model on the database for the duration of this operation.

Available disk space on the SQL server is why I found this script. In my scenario the upgrade stalled and failed because we ran out of disk space. After restoring the database from the last night’s backup and then having to reinstall VC 2.0.2 we were ready to upgrade again, but it was definitely an unexpected hour or so of scrambling. Make sure the SQL server has enough free disk space before you upgrade to VC 2.5 regardless if you are purging any old data or not.

Related Posts

  • http://blog.scottlowe.org Scott Lowe

    Rich, how low was the disk space on the VC server before you started the upgrade? I’m just trying to get a feel for how much space the upgrade chewed through. Thanks!

  • http://blog.scottlowe.org Scott Lowe

    Rich, how low was the disk space on the VC server before you started the upgrade? I’m just trying to get a feel for how much space the upgrade chewed through. Thanks!

  • http://vmetc.com rbrambley

    Scott,

    Unfortunately, I am not sure. I never got to see the diagnostic messages after the client’s DBA ran the script. I know the original VC2 database was around 7GB, and then I was told the SQL server had over 25GB of free space. They ran the script and cleaned up some other databases on the server. The next chance I get to use the script I will try to capture the results.

  • http://vmetc.com Rich

    Scott,

    Unfortunately, I am not sure. I never got to see the diagnostic messages after the client’s DBA ran the script. I know the original VC2 database was around 7GB, and then I was told the SQL server had over 25GB of free space. They ran the script and cleaned up some other databases on the server. The next chance I get to use the script I will try to capture the results.

Get My Podcast On iTunes!
Support VM /ETC
Support VMETC.com

Support VMETC.com

Free Business and Tech Magazines and eBooks
@rbrambley tweets
VMTN Roundtable Podcasts
Subscribe



Add to Google Reader or Homepage
Subscribe in NewsGator Online
Add to netvibes
Add to Plusmo