How to backup vCenter running SQL Express

I found a great way to backup the vCenter SQL database running on SQL Express. The downside of running vCenter on SQL Express is the lack of the SQL agent. So running a scheduled backup of the SQL database is a bit tricky.

ExpressMaint is a small application set of scripts/stored procedures that enables you to run backup and maintenance jobs from commandline.(You could run the application ExpressMaint as well, but I installed the stored procedure version.)

I installed and configured it by doing the following:

  1. I created c:\backups to store my backups
  2. I downloaded the ExpressMaint TSQL file.
  3. I opened a new cmd.exe (with administrative rights) and installed the Stored Procedure by running:
    sqlcmd -S .\SQLEXP_VIM -i c:\expressmaint.sql
  4. I created c:\backups\database to store my database backups
  5. I created c:\backups\reports to store my reports
  6. I created c:\backups\backupscript.sql (SQL file that contains the backup settings, note that my script performs the backup and rebuilds the indexes on the vCenter database):
    exec expressmaint
    @database = 'ALL_USER',
    @optype = 'DB',
    @backupfldr = 'c:\backups\databases',
    @reportfldr = 'c:\backups\reports',
    @verify = 1,
    @dbretainunit = 'days',
    @dbretainval = 5,
    @rptretainunit = 'weeks',
    @rptretainval = 1,
    @report = 1
    exec expressmaint
    @database = 'VIM_VCDB',
    @optype = 'REINDEX',
    @reportfldr = 'c:\backups\reports',
    @rptretainunit = 'days',
    @rptretainval = 1,
    @report = 1
  7. I created c:\backups\PerformBackup.cmd (this is the batch script that executes the backup):
    sqlcmd -S .\SQLEXP_VIM -i c:\backups\backupscript.sql
  8. I schedule c:\backups\PerformBackup.cmd using the ordinary Windows scheduled task manager.

Comments are closed.