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:
- I created
c:\backupsto store my backups - I downloaded the ExpressMaint TSQL file.
- I opened a new cmd.exe (with administrative rights) and installed the Stored Procedure by running:
sqlcmd -S .\SQLEXP_VIM -i c:\expressmaint.sql - I created
c:\backups\databaseto store my database backups - I created
c:\backups\reportsto store my reports - 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 - I created
c:\backups\PerformBackup.cmd(this is the batch script that executes the backup):
sqlcmd -S .\SQLEXP_VIM -i c:\backups\backupscript.sql - I schedule
c:\backups\PerformBackup.cmdusing the ordinary Windows scheduled task manager.