Commvault Simpana – Automating DBMaintenance utility execution with qlogin and Powershell

Running the dbmaintenance utility regularly is a great way to get the Commcell database in ‘primo shape.

Over time, data is aged, clients are reconfigured/deleted and this can all add up to indexes getting out of date, oversized tables etc.

It’s recommended to do a Full DBMAINTENANCE operation every 6 months, as per CommVault latest guidance :
https://ma.commvault.com/KB/Details/30208

A ‘FULL’ run of the utility checks the DB for inconsistencies, re-indexes all tables and shrinks the database. The ‘RECOMMENDED’ run does the same, without running the shrink db operation.

Note that with V10, the database services do not need to be stopped to run this process, but jobs should be suspended as well as the scheduler.

Check the books-online reference here;

http://documentation.commvault.com/commvault/v10/article?p=features/tools/db_maintenance.htm

To assist with automating this process, and to have it run ‘set & forget’ I devised a Powershell script to assist.

This script does the following;

  • Connects to the Commcell, suspends any running jobs & suspends the job scheduler.
  • Runs the DBMAINTENANCE process in FULL mode
  • Re-enables the Job Scheduler
  • Resumes and previously suspended jobs
  • Logs out of the Commcell
  • Emails the DBMAINTENANCE execution output/log to a designated email address(s).

Script is below; Change parameters/variables as required

Let’s see it in action;

Execution in progress inside PS session; Not all command return status/execution codes but you can see the gist;

19-02-2015 11-28-25 PM

 

 

 

 

 

From the commcell GUI; Jobs being suspended and resumed;

19-02-2015 11-31-41 PM

 

 

 

Email with execution log attached; and some nice stats.

19-02-2015 11-33-21 PM

and to verify it all did actually happen ! DBMaintenance.log and qcommand.log;

19-02-2015 11-35-01 PM

So go ahead, download it, configure it, schedule it and forget about it 🙂

 

 

 

 

 

 

 

 

Related Post

4 thoughts on “Commvault Simpana – Automating DBMaintenance utility execution with qlogin and Powershell

    1. Hi thanks. No specific reason I didn’t use a workflow. Maybe I’ll do that in a future post 🙂

  1. Just wanted to note that you probably don’t want to run the dbmaint -full any more often than 6 months. If you run it too frequently it’ll cause DB fragmentation and actually decrease your performance.

    https://ma.commvault.com/KB/Details/30208
    Shrinking the database increases fragmentation. This is because shrinking works by moving most used data pages to the beginning of the data file and truncating the unused part of the data file. Since relations between data pages (as in the ones that belong to the same table) is not considered, shrinking results in a lot of logical fragmentation.

    Run these instead to cover all bases between 6 monthly full dbmaints:
    dbmaintenance.exe –recommended
    or
    dbmaintenance.exe –checkdb
    dbmaintenance.exe –reindexall

    1. Thanks Brendan, looks like the official guidance may have been updated. I’ve updated the post to reflect.

      –Brett

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: