One of the difficult tasks for Exchange administrators is to recover or restore Exchange database. In this blog post, I will share with you how to restore Exchange database using Symantec backup exec. The version of Exchange I am working on is Exchange 2010. I am supposing that you are restoring from a full backup Exchange database and using either Backup Exec 2010 or 2012.
Step 1: Creating the Recovery Exchange Database
You have to create what is called a recovery database in your Exchange environment. This can be any Exchange server with mailbox role installed. I usually deploy a dedicated Exchange mailbox server for the purpose of recovering databases, so that I would not touch my live Exchange server environment. The steps to create the recovery database are:
- Create a Recovery DB named RecoveryDB by running this Power Shell command
New-MailboxDatabase -Recovery -Name RecoveryDB -Server ServerName -EDBFilePath "F:\Exchange Server\Recovery Databases\RecoveryDB\DB\RecoveryDB.edb" -LogFolderPath "F:\Exchange Server\Recovery Databases\RecoveryDB\LOG"
- Mount the database and check (This database can be overwritten by a restore).
- Dismount the database before starting the restore job.
Step 2: Restore Database from Tape (Backup Exec)
Use Backup Exec to run a restore job. ServerName in the below picture represent the Exchange Mailbox Server where the recovery database is hosted (mounted)
Or using the new Backup Exec 2012, here are the screenshots:
Backup Exec is great because it will restore the database, and then go and replay all logs. In short words, after the restore, the restored database will be in a clean shutdown scenario.
Step 3: Restore Database from Snapshot
If you are restoring from Snapshot software like DellCompellent snapshots, then the restore will bring the recovery database to dirty shutdown, simply because snapshot restore will not replay the logs back. You have to do it manually by :
- Make sure your logs and DB files are in same directory.
- Delete the CHK file
- To dump the database and to check if the database is dirty shutdown, type (eseutil /mh dbfile.edb )
- To replay logs and bring the database to healthy (clean shutdown), type (eseutil /R EXX /I /D), Where EXX is the log prefix
Recover a single mailbox
Now let us extract the content of a mailbox for User named “John Smith” whose SamAccountName is “JohnS”. First, you need to get information about mailboxes in the recovery database after it is mounted:
Get-MailboxDatabase RecoveryDB | Get-MailboxStatistics
Note: All restore operations uses the mailbox DisplayName or GUID to identify mailboxes in the recovery database and not SamAccountName.
Now, to restore data to the live user mailbox (John Smith) under a folder named RecoveryItems, we will run the following PowerShell command:
New-MailboxRestoreRequest –SourceDatabase RecoveryDB –SourceStoreMailbox “John Smith” –TargetMailbox “John Smith” –TargetFolder RecoveryItems
New-MailboxRestoreRequest: is the new way for restoring items. It is a background process so, when you run the command, nothing will happen, but in the background, Exchange will start working on the request.
To get information about what is happening after submitting the request, type:
Get-MailboxRestoreRequest | Get-MailboxRequestStatistics
SourceStoreMailbox: is the user that you want to recover his mailbox. You cannot use the user’s SamAccountName here (JohnS) for example, you only can use the user’s Display Name or GUID
TargetMailbox: is the user mailbox that you want to restore things to.
TargetFodler: is the folder that is created in the TargetMailbox with all restored items. If you don’t mention this parameter, then the command will merge content from the restored items and the (TargetMailbox) items.
You can however, restore the mailbox content from the backup, to different mailbox. You could create a dummy user called TestUser, and assign him a mailbox, and then you can restore JohS mailbox to that dummy mailbox for inspection perhaps. To do so, you have to run this PowerShell command:
New-MailboxRestoreRequest –SourceDatabase RecoveryDB –SourceStoreMailbox “John Smith” –TargetMailbox “TestUser” –AllowLegacyDNMismatch
AlowLegacyDNMismatch is simply telling Exchange that we want to restore John Smith mailbox to another temp mailbox.
I hope by now you know how to restore Exchange database, and what options you have. Sometimes, bad things happen and the above way of restoring a single mailbox will not work. Going back to old ways might solve the issue, by running the Restore-Mailbox command and not the New-MailboxRestoreRequest:
Restore-Mailbox -Identity "John Smith" -RecoveryDatabase RecoveryDB -RecoveryMailbox "TempUser" -TargetFolder "Recovery"