vCenter 5.1 Backups for SSO, SSL and MSSQL DB

Overview

When I upgraded to vCenter 5.1 and being the conscientious IT pro that I am 🙂 I made sure I had good backups for all the relevant bits to restore in case of an emergency.  This is not intended to replace a proper backup solution like Veeam Backup and Replication (which is an excellent bit of software which I actually use and highly recommend) but rather as a “belt and braces” supplement.

I have separated vCenter and MSSQL DB servers running on 2 VMs running Windows 2008 R2 (64bit).  My DB server is holding the vCenter, SSO (Single Sign On) and VUM (VMware Update Manager) databases.  Just to be clear here, this is not the vCenter Appliance.

Disclaimer

If you are using any of these instructions for production vCenter implementations then please, please, please ensure you test everything.  There are few things worse in IT than being in a bad situation with broken or non-existent backups.

Pre-Requisites

You will need an additional server with some disk space available to copy data to.  You will also need to assign some dedicated disk space to the local vCenter DB server to perform the DB dumps to.

SSO Backups

SSO was introduced with vCenter 5.x and is one of the most critical components of vCenter.  Lose this and you will have a hard time getting back up and running.  I run the following batch file script via a scheduled task to backup the files to local disk and to a remote server. This batch file will rotate through 7 days of backups and also copy to a remote server.  These files combined with the DB backups should allow you to restore SSO to full functionality in the event of a disaster.

Script name : SSO_Backup.bat

SSL Backups

If you want to rebuild your vCenter quickly then you will need to retrieve your SSL settings.  This is basically the same script as the used for the SSO Backups.

Script name : SSL_Backup.bat

DB Backups

The DB is probably the most important part to backup.  With no DB you have no vCenter.  If you lose vCenter but you still have your DB then in theory all you need to do is reinstall vCenter and point back at the DB.

There are lots of really good resources on setting up MSSQL Maintenance Plans, but I’m listing my method here anyway (hopefully it’s the generally accepted way to do this :)).

MSSQL Operators

It’s always good to notify yourself (and others) of the success or failure of critical jobs like Backups so you’ll need to create an Operator to send emails to.

So first up login to server holding the DB and fire up the Microsoft SQL Server Management Studio, click down to SQL Server Agent and Right-click Operators and then New Operator.  Fill in Name and Email fields and then click OK.

Database Mail

Now configure SQL to send email.  Click Management, right-click Database Mail, configure Database Mail and follow the wizard to create a new Profile (it may ask you to “enable the Mail feature”, just click OK.

Now name the profile and click add an smtp account, then fill in the details.

Make the profile public and default.

Click Next through to the end and Finish.

Maintenance Plan

Now click down to Management and Maintenance Plans.  Right click Maintenance Plans and create a new maintenance plan (call it whatever you like but I named mine “All DBs – Full Backup Job”.

Now drag and drop the following plan tasks into the right hand pane:-

  • Maintenance Cleanup Task
  • Back Up Database Task
  • Notify Operator Task x 2

Now link the jobs by dragging the arrows around.  Right click the “Database to Notify Operator Task 1” arrow and change to “Failure”.

Double-click both Notify Jobs and tick your operator(s) and complete the subject and body fields (you should probably rename the tasks just for clarity).

Now double-click the maintenance plan task.  You can either select individual DBs to backup or choose all.  I just choose them all and then tick the “Create a sub-directory for each database”.  Now select your backup folder (this must be local to the server and cannot be a mapped network drive, which is a bit crap and forces you to create a seperate scheduled task to handle this if you require it….more on this further down).

Now you need to edit the Maintenance Cleanup Task to remove old DB backup files.  So input your backup directory, put “bak” in the File extension box and tick “Include first-level subfolders”.  At this stage you can adjust how long you want to keep files on disk.  I don’t keep more than a few days usually.

Now click on the Subplan Schedule button….

And set your schedule up, mine will run evey day at midnight.

NOTE: The user that was used to create this Maintenance Plan is the current “owner” of the job. If you ever have permissions problems when running your job then look to this setting in SQL Server Agent, Jobs, under Properties of the job.

Copy backups to another server!

As you are not allowed to backup DBs direct to a network share or a mapped drive, then if you want to ship these DB backup files to another server (for off-site purposes etc) then you will need to create a seperate scheduled task.  I just run a nightly robocopy script on a scheduled job that runs a few hours after the maintenance plan run completes.  My robocopy script looks like this:-

3 Replies to “vCenter 5.1 Backups for SSO, SSL and MSSQL DB”

  1. this is awesome but only works if you are running full SQL :-(. I am running SQL Express that comes with vcenter so I don’t have all the cool maintenance plan stuff

  2. Hi,

    Thanks!

    One note. If i just copy paste your scripts in this post then all the ” ” marks need to be replaced. e.g. cd “D:\Program Files\VMware\Infrastructure\SSOServer\scripts”

Leave a Reply

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