Select Page

How to restore Exchange database

How to restore Exchange database
Advertisement

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

  • 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)

restore Exchange database 1

restore Exchange database2

Or using the new Backup Exec 2012, here are the screenshots:

restore Exchange database3

restore Exchange database4

restore Exchange database5

restore Exchange database6

 

 

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:

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:

Where:

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:

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:

AlowLegacyDNMismatch is simply telling Exchange that we want to restore John Smith mailbox to another temp mailbox.

Final Notes

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:

About The Author

Ammar Hasayen

Ammar is a digital transformer, cloud architect, public speaker and blogger. He is considered a trusted advisory with the ability to quickly navigate complex multi-cultural organizations and continuously improve and motivate cross-functional teams to achieve higher productivity, collaboration, revenue gain and cross-group knowledge sharing. His contributions to the tech community helped him get awarded the Microsoft Most Valuable Professional. Ammar appears in a lot of global conferences, and he has many publications about digital transformation and next generation technologies.

Leave a reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hi, I’m Ammar Hasayen

Ammar-New-MVP

About Me

Cloud Architect | Cybersecurity | CISSP | Microsoft MVP | Pluralsight Author | Book Author | International Speaker | World Explorer | @ammarhasayen

 

LinkedIn Profile

My Pluralsight Course

Speaking at Microsoft Ignite Dubai

Ammar Hasayen Speaker Ignite

Pin It on Pinterest