Last week I got a request from a customer. A long time ago I posted a blogpost on Exchange 2010 recovery databases, but after the customer migrated to Exchange 2016 his procedure around recovery databases didn’t work anymore. His request was basically to rewrite my blogpost.
For this blogpost I have a pretty simple Exchange 2016 Mailbox server, configured with one Mailbox database which is stored on a dedicated disk, and I’m using Windows Server Backup to backup the entire Mailbox database disk (VSS full backup).
Don’t pay too much attention to the naming of my Exchange server and the Mailbox database I’m using here. In fact, this is an Exchange 2016 hybrid server I’m misusing for the purpose of this blog
Recovery database
You can restore a mailbox database to its original location and mount again, but you can also use a Recovery Database to restore and recover your data. A recovery database is a mailbox database that can be mounted on your Exchange server, but it is not visible for regular users but only for the Exchange administrator. The Exchange administrator can access this recovery database and recover data, for example create a PST of a particular mailbox in this database.
When restoring a database from backup, select the restore option and follow the wizard. When you reach the Select Recovery Type window select Applications as shown in the following screenshot.
There’s only one application available on this Exchange server (but this can be different in your environment of course) so in the Select Application window you should see Exchange as shown in the following screenshot:
If you don’t see Exchange here there’s something wrong with your Exchange backup. Most likely if this is the case you are creating backups on a file level instead of Exchange level.
The next step is to determine where to restore the mailbox database. You can select the Recover to original location option but this will overwrite the existing mailbox database and that’s not we want to achieve here. The second option is Recover to another location, select this option and enter a directory where to restore, like C:\RecoverDB as shown in the following screenshot:
On the confirmation page click the Recover button to restore the mailbox database from backup.
When the restore is complete and you check the C:\RecoverDB directory you will see a directory structure reflecting the original location of the mailbox database. When you browse this directory you’ll find the mailbox database and the accompanying log files:
When you open a command prompt, navigate to this directory and execute the ESEUTIL /MH <database filename> command the mailbox database should be in a dirty shutdown state:
This is as expected since the VSS backup is created against a running mailbox database.
To get the mailbox database back into a clean shutdown state we have to replay the remaining log files into the mailbox database. To do this you can use the ESEUTIL /R command. Since we have the logfiles in another directory we have to specify this in the command. In my environment this should be ESEUTIL /R E00 /d /I /LC:\RecoverDB\e0bfb5dc-19f7-44b7-bfc4-189787d97a0f\F_\MDBHYBRID\LogFiles
Note. The /L switch is used to specifiy the location of the transaction log files. There is no space between the /L switch and the path to the transaction log files.
When checking the mailbox database it should be in a clean shutdown state:
At this point we have recovered the mailbox database and continue working with it.
Create Recovery Mailbox database
The only way to create a Recovery Mailbox database is in PowerShell using the New-Mailbox database with the -Recovery switch.
New-MailboxDatabase -Name RecoveryDB -Server EXCH01 -EdbFilePath C:\RecoverDB\e0bfb5dc-19f7-44b7-bfc4-189787d97a0f\F_\MDBHYBRID\MDBHYBRID.EDB -LogFolderPath C:\RecoverDB\e0bfb5dc-19f7-44b7-bfc4-189787d97a0f\F_\MDBHYBRID -Recovery
The -Recovery switch will create a recovery mailbox database instead of a regular mailbox database, and because of this you can use the existing mailbox database file for the recovery database. Exchange PowerShell will also show this on the console:
You can now mount the Recovery Mailbox database using the Mount-Database -Identity RecoveryDB command in Exchange PowerShell.