Well I guess the title of this article perhaps might belong in a techno nerdy film (or perhaps not); but as it indeed suggests I have been playing around with Exchange 2007 SP2 (like many Exchange admins) but more to the point the new (and long awaited) VSS plug in for Windows 2008 Server.
The Exchange Plug-in for Windows 2008 contained within Exchange SP 2 has been on my radar over the last few weeks, mainly because I was asked to write a separate article for a very well known technical website (more on this in a later post I cannot say too much here) based around Exchange 2007 Disaster Recovery and as with all my articles I had performed quite a bit of research.
For those of you whom have missed it – or indeed just perhaps might not care, Service Pack 1 for Exchange 2007 was a but of a milestone for Exchange Server as it was made compatible (or perhaps more to the point was supported on Windows 2008 SP1) – however; public outcry was not far behind this particular event; as many Exchange Admin quickly noticed that in a rather cruel deviation from history there was no native support to back-up Exchange within Windows.
For the benefit of those of you whom have not been with us for the last 10 years in essence; Windows Server from Windows NT 4.0 and Exchange 5.5 once Exchange was installed on the host platform the native Windows back-up tool was upgraded to support Exchange backup. This was enjoyed all the way through many versions of Windows and Exchange up to Windows 2003 x64 and Exchange 2007 (RTM, SP1 and 2) however in the event of Windows 2008 support for Exchange 2007 (from Exchange SP1) this support stopped.
The only way in which you could back-up Exchange here on in (on a Windows 2008 platform) was via a file backup – which of course meant dismounting your databases – performing the backup and then remount databases – all possible, but a little messy and meant downtime on your store.
There has been much discussion about this about this in forums which if you have some time you can see examples of which:
To cut a long story short the Windows Team and Exchange team got their heads together and decided that on the basis of the feedback that they had received from the Exchange community, support for Exchange backups should remain and would be included within the release of SP2 for Exchange 2007.
Anyhow the above provides a brief pre-amble to where I am at; and I would like to now fast forward to the article at hand – the Exchange Plug-In with Recovery Storage Groups.
I do not intend to cover the Exchange VSS plug-ins functionality in any great detail as this has been blogged verbatim by many folks on the web; what I would like the focus of this article to surround is a subject which caught my eye within a two part series by Microsoft Certified Architect and MVP Henrik Walther which was published on MSExchange.org here and here; where he described that natively Windows Back-up 2008 with the Exchange 2007 does not support Recovery Storage Groups.
Of course Henrik is correct and I am not about to make a revelation which he had missed (not a chance), as indeed in the second part of Henrik’s series he described how you can use Windows 2008 Backup with the Exchange Plug-in with RSG’s.
This interested me a great deal as I started to think that there must be a way of simplifying the process using Powershell.
So I came up with the following script which accomplishes the following tasks:
- Patches a recovered Exchange Database and TS logs from Windows 2008 Server Backup with the Exchange 2007 SP plug-in
- Creates a Recovery Storage Group
- Moves the patched Database and TS logs to the RSG
As there are a number of steps to my script and this is quite a long article I have also enclose a Video overview of the processes involved in using the script – this can be viewed / downloaded from here:
- Download the above script to the Exchange Server on which you will be using Windows Server Backup 2008 and intend to create you RSG
- Ensure that the Execution Policy is set to “Remote Signed” – this can be performed by opening an Exchange Management Shell prompt and typing in the following command Set-ExecutionPolicy "RemoteSigned”
Restoring from Backup
The following is an overview of how (when using the above script) you should restore your Exchange Database and Transaction Logs via Windows Server 2008 Backup.
Open the Windows 2008 Server Backup utility from [ Start –> Programs –> Administrative Tools –> Windows Server Backup ] and then from the “Actions” menu on the right hand side of the screen choose the “Recover” option – see below
You will be presented with the “Getting Started” screen – ensure that the “This Server ” Radio button is checked; when happy that it is click on the “Next” button – see below
You will be presented with the “Backup Date” screen – from here choose the date range in which your desired backup was taken, when happy click on the “Next” button – see below
You will then be asked to choose the recovery type – you ** Can ** choose “Application” if you so whish – but because the backup tool is not RSG aware I found in my testing that using the API plug-in did not serve any real purpose aside from restoring the DB and TS logs from the backup set – so for simplicity I have chosen to use the “Files and Folders” option – click on the next button when you are ready to proceed – see below
You will be asked to select the files and folders which are available in the Backup set – I have personally gone down to the level where I get just the Database and Logs folders plus their content – this stage might be a little different for you as in production environment you would of course have the DB’s and TS logs on separate Volumes – choose the files which are most relevant for your configuration (you might need to run the recovery process twice if your TS logs are on a separate volume from the Database) – see below
You will be asked to choose the location to restore the files within the backup set to.
In order to make use of the RSG (and indeed make sure that your production databases are protected from the restoration) you will need to make sure that you have chosen the “Another Location” option – I recommend that you create a folder on your Exchange Server which will contain the restored files (as in my example I have created a location called “Recovered Databases” – this allows for easy identification during the execution of the script – when you are happy with your choices – click on the “Next” button – see below
You will be asked to confirm the restoration – click on the “Next” button – see below
The files will then be recovered from the backup set to the location that you stipulated in Step 6 – when completed click on the “Close” button – see below
Using the tool;
Before continuing make sure that you have set the Execution Policy to remote signed.
Open an Exchange Management Shell window, then navigate to the location where you downloaded the script to and type in the following command:
.\WindowsBUEPIRSG.ps1 and press <enter>
Ignore the file name from the example screenshot below.
Once executed you will be presented with the screen below – you will be asked for the prefix of the transaction logs which reside in the restored TS log location – this is typically E0x – as in my example all of my TS logs start E01 – you will need to confirm this and enter in the correct value and then press – see below
You will then be presented with a “Browse for Folder” dialog box – you are being asked for the location of the RESTORED Transaction logs – you will only need to select the parent folder which contains the restored logs – see below
You will then be asked to provide the location for the System Path CHK file – as a point of note, my script assumes that this in the SAME location as the TS logs – if this should present a problem for you please contact me and I will submit an update to the script – otherwise you are also welcome to make the modifications you require – see below
You will then be presented with a standard windows Open Dialog box – here you should locate the RESTORED EDB file from your backup – see below
The script will then attempt to perform a “Soft Recovery” of the database by replying all of the restored transaction logs – the objective here is to get the database into a “Clean Shutdown” State.
Essentially you will be presented with a report which looks like the following example –
-------------------------------------------------------------------------------- Log File Location: B:\Recovered-Databases\Logs System Path Location: B:\Recovered-Databases\Logs Selected Database: B:\Recovered-Databases\DB\GenDB.edb -------------------------------------------------------------------------------- Extensible Storage Engine Utilities for Microsoft(R) Exchange Server Version 08.02 Copyright (C) Microsoft Corporation. All Rights Reserved. Initiating RECOVERY mode... Logfile base name: e01 Log files: B:\Recovered-Databases\Logs\ System files: B:\Recovered-Databases\Logs\ Database Directory: B:\Recovered-Databases\DB\GenDB.edb Performing soft recovery... Restore Status (% complete) 0 10 20 30 40 50 60 70 80 90 100 |----|----|----|----|----|----|----|----|----|----| ................................................... Operation completed successfully in 0.422 seconds. Extensible Storage Engine Utilities for Microsoft(R) Exchange Server Version 08.02 Copyright (C) Microsoft Corporation. All Rights Reserved. Initiating FILE DUMP mode... Database: B:\Recovered-Databases\DB\GenDB.edb File Type: Database Format ulMagic: 0x89abcdef Engine ulMagic: 0x89abcdef Format ulVersion: 0x620,12 Engine ulVersion: 0x620,12 Created ulVersion: 0x620,12 DB Signature: Create time:06/13/2010 17:56:03 Rand:1974337 Computer: cbDbPage: 8192 dbtime: 94099 (0x16f93) State: Dirty Shutdown Log Required: 41-41 (0x29-0x29) Log Committed: 0-42 (0x0-0x2a) Streaming File: No Shadowed: Yes Last Objid: 1151 Scrub Dbtime: 0 (0x0) Scrub Date: 00/00/1900 00:00:00 Repair Count: 0 Repair Date: 00/00/1900 00:00:00 Old Repair Count: 0 Last Consistent: (0x26,45,78) 06/15/2010 10:17:14 Last Attach: (0x28,A,F7) 06/15/2010 10:17:21 Last Detach: (0x0,0,0) 00/00/1900 00:00:00 Dbid: 1 Log Signature: Create time:06/13/2010 17:56:02 Rand:1984650 Computer: OS Version: (6.0.6002 SP 2 NLS 500100.50100) Previous Full Backup: Log Gen: 34-35 (0x22-0x23) - OSSnapshot Mark: (0x24,8,16) Mark: 06/14/2010 14:56:07 Previous Incremental Backup: Log Gen: 0-0 (0x0-0x0) Mark: (0x0,0,0) Mark: 00/00/1900 00:00:00 Previous Copy Backup: Log Gen: 0-0 (0x0-0x0) Mark: (0x0,0,0) Mark: 00/00/1900 00:00:00 Previous Differential Backup: Log Gen: 0-0 (0x0-0x0) Mark: (0x0,0,0) Mark: 00/00/1900 00:00:00 Current Full Backup: Log Gen: 0-0 (0x0-0x0) Mark: (0x0,0,0) Mark: 00/00/1900 00:00:00 Current Shadow copy backup: Log Gen: 0-0 (0x0-0x0) Mark: (0x0,0,0) Mark: 00/00/1900 00:00:00 cpgUpgrade55Format: 0 cpgUpgradeFreePages: 0 cpgUpgradeSpaceMapPages: 0 ECC Fix Success Count: none Old ECC Fix Success Count: none ECC Fix Error Count: none Old ECC Fix Error Count: none Bad Checksum Error Count: none Old bad Checksum Error Count: none Operation completed successfully in 0.47 seconds. Please verify the above report - please ensure that the database has a Status of: Clean Shutdown
It is essential that you review the report as there is a line entitled “State”, you should see a value of “Clean Shutdown” – see below
If the database is in a Dirty Shutdown (as per above) answer “N” to the following question which the script will now be asking:
Does the restored Database Show as a clean Shutdown (Y or N)?:
The script will then take corrective action to allow for the restored database to mount within the RSG by executing a Hard Repair against the database (which I know is pretty drastic – but from my tests has resulted in no data loss).
NOTE: I added the Hard Repair option to the script as for some reason in my tests I seemed to end up with missing log files from the Backup set which the soft repair needed to make the recovered database consistent – this MAY NOT HAPPEN in your environments!
You will be prompted for confirmation to run the Hard Repair – click on “OK” – see below
ESEUTIL with then repair the restored database – see below
You will then be asked by the script to Choose the Exchange 2007 Mailbox server where you would like to create the RSG (remember that this should be the same server where the backup was taken from) – choose the numerical representation of the server which matches your server (if you only have one mailbox server the script will move onto the next step automatically – see below
When you have chosen the Exchange Server on which that you would like to create your RSG you will be asked to provide a location for the RSG’s TS logs (again from the Browse Folder dialog) – choose your location and then click “OK” – see below
You will then be asked to specify the RSG’S system path – I strongly recommend that this is in the same location as the TS Logs – see below
The script will then ask you to provide a name for your RSG – this can be any name that you like – see below
After creating the RSG you will be asked to provide the name and location for the EDB file that will be used within your RSG – it is VERY important that you give the EDB file the SAME name as the original EDB from the source database – if you use a custom name then the RSG will mount a database that does not contain your mailbox data – see below
The script will then ask you to choose the database that you would like to assign to the RSG, you will be presented with a list of databases which reside on your chosen server – your choice of could should represent the database that you have restored from backup – see below
You will then be presented with a Windows browse dialog – this will be asking for the location of the TS logs which you RESTORED from backup – navigate to the location and click “OK” – see below
You will then be asked to browse to the folder where the logs should be copied to (this will be the TS logs folder for the RECOVERY STORAGE GROUP) – chose this location and click on the “OK” button – see below
You will then be prompted for the source location of the Exchange Database that you restored from Backup – see below
You will then be asked to browse to a destination location where the backup file that you restored will be copied to – see below
The script will then perform the final copy actions and complete – see below
Merging from the RSG
We should now be in a position to mount the Database within the Recovery Storage group and the perform the process of merging content back into the Production Exchange Database’s.
Open up the Exchange Management Console and navigate to [ Toolbox –> Database Recovery Management ] – see below
The wizard will attempt to find updates for the Recovery Tool – when this is completed begin the task wizard – you can provide a name for the task should you wish, ensure that the server details are correct and then click on the “Next” link – see below
You will then be asked to choose a specific function for the task that you wish to carry out – choose “Mount or Dismount databases in the Recovery Storage Group” – see below
You will be presented with the RSG that the script created – select the check box and then click on the “Mount Selected Database” link – see below
The wizard will then present to you (hopefully) that the database has been mounted correctly click on the “Go back to task centre” link – see below
Choose the “Merge or Copy Mailbox Contents” link – see below
Make sure that the your RSG Database is selected and then click on the “Gather Merge Information” link – see below
Click on the “Perform Pre merge tasks” link – see below
You will then be presented with a list of the mailboxes that are contained in the RSG database – from here you can copy or merge content back into the original store – see below
I hope that you find the above useful – and in some way for those of you whom make use of Windows 2008 Server backup for restoration purposes makes the process of Recovery Storage Groups simpler.