How to Use a Recovery Database in Exchange 2010

Friday, October 30, 2009
This is another in my series of articles on Exchange 2010.  In this post I'll be writing about the Recovery Database feature in Exchange 2010.

Exchange 2010 no longer has the notion of Storage Groups, which were used in Exchange 2007 and 2003 to contain logical groupings of databases.  E2010 now simply lets you create databases on mailbox servers.  E2010 Standard Edition lets you create up to 5 databases per server. The Enterprise Edtion scales up to 100 databases per server.

In Exchange 2003/2007 you could restore a database "on top" of an original database to replace the existing database, or you could restore the database "along side" the existing database to recover select mailboxes or items.  You can do the same thing with Exchange 2010.  The difference is that in Exchange 2003/2007, you created a Recover Storage Group (RSG) to restore the database into.  In Exchange 2010, you simply restore the database and connect to it as a Recovery Database (RDB).  Here's how you do it in Exchange 2010.
Note: Ross Smith IV has a great article on single item recovery in Exchange 2010.  This assumes that the item can be recovered from the dumpster.  This article covers how to restore from a backup when the item cannot be recovered from the dumpster.  For example, on the rare occasion when a user realizes he/she deleted a folder or item past the dumpster retention period.
First, you have to have a good backup that contains the item to be recovered.  Windows Server 2008 and Windows Server 2008 R2 have the built-in Windows Server Backup feature.  I cover how to use WSB to backup Exchange here.

Now you must restore the data, but redirect it to another location.  In Windows Server Backup, this is done by choosing to recover the Exchange application (detailed in my previous article) and recovered to another location.  Typically, this is a new folder on the same Exchange server:


Once the recovery is complete, the database (EDB file) and transaction logs (LOG files) will reside in the new recovery D:\Recovery folder.  Note that WSB will not create this folder, it must already exist.

Now you need to add this database to the Exchange mailbox server as a Recovery Database. Currently, this is done using the Exchange Management Shell (EMS), as there is no way to do this from the GUI.  Run the following command to create a Recovery Database:
New-MailboxDatabase -Recovery -Name RDB1 -Server EX1 -EdbFilePath "D:\Recovery\Mailbox Database 1882717321.edb" -LogFolderPath "D:\Recovery"
This will cause Exchange to create a new recovery database named RDB1 on server EX1 using the database and logs in D:\Recovery.  Once this command is run, you will see the recovery database in the Exchange Management Console (EMC), but it must be brought into a clean shutdown state before it can be mounted.

To bring the database into a clean shutdown state, use ESEUTIL /R to perform a recovery of the database.  Often, I've seen that Exchange is unable to perform a successful recovery, giving the following error:
Operation terminated with error -1216 (JET_errAttachedDatabaseMismatch, An outstanding database attachment has been detected at the start or end of recovery, but database is missing or does not match attachment info) after 11.625 seconds.
In these cases, I have run an ESEUTIL /P (repair) to force the database into consistency.  Once the database has been successfully recovered or repaired, mount the database in EMC or using the Mount-Database cmdlet.

Now we're ready to recover deleted items from the recovery database.  In order to do this, though, you need Organization Management rights in Exchange 2010.  The following are cmdlet examples for recovering items from the RDB:

This example restores a mailbox for user Keith Johnson, overwriting the existing mailbox:
Restore-Mailbox -ID 'Keith Johnson' -RecoveryDatabase RDB1
This example restores Keith Johnson's mailbox content into an Investigation mailbox:
Restore-Mailbox -ID 'Investigation' -RecoveryDatabase RDB1 -RecoveryMailbox 'Keith Johnson'
This example restores only the mail with the word "contract" in the subject and the word "CompanyABC" in the body of the message from the Inbox or Saved folders.
Restore-Mailbox -ID 'Keith Johnson' -RecoveryDatabase RDB1 -SubjectKeywords 'contract' -ContentKeywords 'companyabc' -IncludeFolders \Inbox,\Saved
There are a lot of different options in the Restore-Mailbox cmdlet and recovery databases that make it a powerful tool for recovery.  Take the time to learn them before you need to use them.

13 comments:

  1. Hey Jeff,

    Great blog post! One quick thought - you should not have to run a /p against the restored DB. If you run eseutil Enn /r /i /d in the same folder as the dirty restored DB and logs, it should play back clean for you. The /i switch specifically ignores any "hanging attachments".

    ReplyDelete
  2. What is the time it takes for the ESEUTIL step to run? I've read estimates from 1 to 10 GB per hour depending on the options used. Does this seem correct?

    ReplyDelete
  3. Typical a Microsoft answer -- it depends.

    Direct attached SCSI may take around 6GB/hour, but I've seen some high performance fibre channel SANs with HUGE caching controllers get up to 180GB/hour.

    ReplyDelete
  4. Severely corrupt or damaged database can not be recovered using ESEUTIL. Commercial third party Exchange Recovery tools are then required which can recover data from EDB file in the form of an Outlook importable PST file.

    ReplyDelete
  5. thanks this article helped a lot but the command is explained backwards...

    -------------------------
    This example restores Keith Johnson's mailbox content into an Investigation mailbox:
    Restore-Mailbox -ID 'Keith Johnson' -RecoveryDatabase RDB1 -RecoveryMailbox Investigation
    -------------------------

    it actually shows a mailbox named Investigation being recovered to Keith Johnson. Keith's would be the Target not the Source.

    ReplyDelete
  6. You are correct, thanks for catching that! I updated the article above.

    ReplyDelete
  7. Hi, is it possible to mount a database that came from a different forest (i.e. from another domain) in that way, and to "import" the mailboxes?
    Thanks

    ReplyDelete
  8. Well, i checked and it does not allow the mounting of a database from a different domain. I guess the PST or CROSS forest transfer is the only way.

    ReplyDelete
  9. We are facing a technical issue while crating Recovery databases.

    The problem scenario is as follows.
    1. User provides transaction log file folder path and edb file path and creates a Recovery database.
    2. As a result of creating Recovery database, new log files are generated in log folder.
    3. User dismounts and removes the recovery database from exchange.
    4. User again provides the same transaction log file folder path and edb file path to create a Recovery database.
    5. Recovery db creation fails with the following error
    "The location that you specified for the transaction log files is invalid. Verify that the directory exists and that there are no files in it."
    6. User deleted the log files generated in step 2 but keeps original log files as it is.
    7. User tries to create recovery database as in step 4. This time creation is successful.

    We modify the exception generated in Step 5 for the time being, to a user friendly message "Please cleanup the log file folder and restore the
    log files from backup to the log file folder".

    We are trying to find a suitable fix for this.


    sumit naik(mail at : sumit@booleanarray.com)

    ReplyDelete
    Replies
    1. These steps worked for me. I got the errors you mentioned initially.

      Create a folder with sufficient free space somewhere to restore the Information Store folder. R:\Recover
      Restore the Mailbox Store to this folder.
      From Exchange Command Shell enter the command: NewMailboxDatabase -Recovery -Name RDB1 -Server -EdbFilePath "R:\Recover\ -LogFolderPath "R:\Recover"
      Change to the Recovery folder: R:\Recover
      Enter the repair command: eseutil E00 /r /i /d
      From Exchange Manager Console, go to Organization Configuration --> Mailbox. Refresh the display and Mount RDB1.
      To Overwrite User Mailbox: Restore-Mailbox -ID '' -RecoveryDatabase RDB1
      To Restore a Mailbox to another User Account: Restore-Mailbox -ID "" RDB1 -RecoveryMailbox ""
      You may be prompted for a location to place recovered data in the traget user mailbox folder tree.
      Use the -IncludeFolders clause to selectively backup folders: eg -IncludeFolders \Calendar

      Delete
  10. Thanks for the process Jeff.
    As mentioned by Anonymous (Nov 23) I had to use the same process and used Display names when specifying mailboxes (see http://social.technet.microsoft.com/Forums/en/exchange2010/thread/f0890ab0-4a0e-49c3-a856-7f1ca6d21298)

    ReplyDelete
  11. Der Jeff,

    Now a days i am facing some problem while restore my mail boxs.Suppose when i enter the below command at exchange management console its work.but 2nd one did not work

    Restore-Mailbox -Identity "user1" -RecoveryDatabase RecoveryDB -RecoveryMailbox "user1" -TargetFolder Restore >>>> Its work

    Problem while when i enter the below command
    Restore-Mailbox -Identity user1 -RecoveryDatabase RecoverDB >> not working.

    My Recover Database is RecoverDB.

    Any one help me in this regards.

    Thanks

    ReplyDelete

Thank you for your comment! It is my hope that you find the information here useful. Let others know if this post helped you out, or if you have a comment or further information.