In Exchange Server 2016 a recovery database allows us to mount a copy of a regular mailbox database on an Exchange server for performing a restore of a mailbox or mailbox items. Recovery databases can only be accessed by administrators performing mailbox restores, they are not accessible by end users via Outlook or any other client application or device, and you will not be able to create new mailboxes on the recovery database.
Using the recovery database will not have an impact on the the active copy of the mailbox database that is running, and a recovery database can be used to mount an Exchange Server 2016 mailbox database from any other server in the same organization.
To recover a mailbox or mailbox items for Exchange Server 2016 using a recovery database the following procedure is used:
- Create the recovery database on an Exchange 2016 server
- Restore a database backup into the recovery database
- Run one or more mailbox restore requests
- Remove the recovery database when it is no longer required
In this article I will demonstrate the complete end to end procedure.
Creating a Recovery Database for Exchange Server 2016
To begin with we create the recovery database object itself. Before you do this you should ensure that you have some storage available on the server to host the database and transaction log files that you will be restoring into the recovery database. The storage can be a volume that already hosts other databases, there is no particular need to use a dedicated volume for this purpose unless you need to keep it separate to ensure that the recovery database is excluded from your regular backups. However I recommend you at least place the recovery database and log files in their own folders away from the active database files.
In the Exchange Management Shell use the New-MailboxDatabase cmdlet to create the recovery database. If you know the EDB file name of the database you’ll be restoring use it now, but if you don’t know it or you need to change it later that’s okay.
[PS] C:\>New-MailboxDatabase -Server EX2016SRV1 -Name RecoveryDB -Recovery -EdbFilePath E:\RecoveryDB\DB05.edb -LogFolderPath F:\RecoveryDB Name Server Recovery ReplicationType ---- ------ -------- --------------- RecoveryDB EX2016SRV1 True None
If you inspect the folder paths that you chose for the recovery database you’ll notice they are empty. Do not mount the recovery database yet. First we need to restore the database and transaction log files from backup.
Restore an Exchange Server 2016 Database into a Recovery Database
The restoration process for Exchange 2016 databases will depend on the backup software that you’re using. You should consult the documentation from your vendor and follow their guidance. Some backup solutions do not use recovery databases at all, and will use their own utility to open the restored database file and extract the contents that you want to recovery. However many others will use the recovery database approach, including Windows Server Backup which I am demonstrating here.
In Windows Server Backup click on Recover to start a new recovery. I am choosing to recover a backup stored on another location.
The backup drive is attached to this server, so I choose Local drives for the location type.
Select the backup drive from the drop down list.
Select the name of the server from the sets on the backup drive.
Select the date from which you want to restore the database and log files.
In a regular Exchange 2016 database recovery we would choose Applications here, but when working with recovery databases we select Files and Folders instead.
From the tree view of available files to restore select the database and log files for the database you’re recovering. Note that if the database and logs are in separate folders then you’ll need to run two separate restore jobs to get them both.
Restore the files to the locations you specified when you created the recovery database earlier.
Confirm your selections and click Recover to begin the restore.
Repeat the restore for the log files as well if necessary, then move on to making the recovered database mountable.
Making a Restored Exchange Server 2016 Database Mountable
If the EDB file you restored is different to the EDB file name you specified when creating the recovery database you’ll need to fix that first. To test whether your recovery database is pointing at the correct file use Test-Path:
[PS] C:\>Test-Path (Get-MailboxDatabase RecoveryDB).EdbFilePath True
If you do not see a result of “True” use Move-DatabasePath with the -ConfigurationOnly switch to update the EdbFilePath attribute to the correct path.
[PS] C:\>Move-DatabasePath RecoveryDB -EdbFilePath E:\RecoveryDB\DB05.edb -ConfigurationOnly Confirm This operation will skip the safety check and make the change to Active Directory directly. Do you want to continue? [Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y Confirm Are you sure you want to perform this action? Moving database path "RecoveryDB".
Next, change directories to the location of the EDB file and use ESEUtil to check the state of the database, which should be in a “Dirty Shutdown” state at the moment. I’ve removed some of the output below for the sake of clarity.
[PS] E:\>cd .\RecoveryDB [PS] E:\RecoveryDB\>eseutil /mh .\DB05.edb Extensible Storage Engine Utilities for Microsoft(R) Exchange Server Version 15.01 Copyright (C) Microsoft Corporation. All Rights Reserved. Initiating FILE DUMP mode... Database: .\DB05.edb Fields: State: Dirty Shutdown
A soft recovery needs to be performed to get the database file to a state of “Clean Shutdown” so that it will mount. We’ll use ESEUtil and we need to know three things to provide as arguments:
- The database file is located in E:RecoveryDB (make sure you verify this by looking in Windows Explorer)
- The transaction log files are located in F:RecoveryDB (again, make sure you verify this)
- The log file prefix is E00 (simply look at the files to see what your prefix is)
That makes the syntax for my soft recovery as follows, running it from the location where the log files are stored:
[PS] E:\RecoveryDB\>cd F:\RecoveryDB [PS] F:\RecoveryDB\>eseutil /r E00 /l F:\RecoveryDB /d E:\RecoveryDB Extensible Storage Engine Utilities for Microsoft(R) Exchange Server Version 15.01 Copyright (C) Microsoft Corporation. All Rights Reserved. Initiating RECOVERY mode... Logfile base name: E00 Log files: F:\RecoveryDB System files: Database Directory: E:\RecoveryDB Performing soft recovery... Restore Status (% complete) 0 10 20 30 40 50 60 70 80 90 100 |----|----|----|----|----|----|----|----|----|----| ................................................... Operation completed successfully in 3.265 seconds.
Those command-line parameters are:
- /r for “Recovery mode”
- E00 is the log file prefix
- /l (that’s a lower-case L) for the log file path
- /d for the folder path containing the database file (do not include the name of the EDB file itself, only the folder path)
Running ESEUtil /mh again should return a “Clean Shutdown” state this time.
[PS] F:\RecoveryDB\>cd E:\RecoveryDB [PS] E:\RecoveryDB\> [PS] E:\RecoveryDB\>eseutil /mh .\DB05.edb Extensible Storage Engine Utilities for Microsoft(R) Exchange Server Version 15.01 Copyright (C) Microsoft Corporation. All Rights Reserved. Initiating FILE DUMP mode... Database: .\DB05.edb Fields: State: Clean Shutdown
The database is now ready to mount for mailbox recovery.
[PS] E:\RecoveryDB\>Mount-Database RecoveryDB
Running Mailbox Restore Requests in Exchange Server 2016
After restoring and mounting the recovery database we can perform one or more mailbox restore requests to retrieve mailbox or mailbox item data. To see which mailboxes are stored within the recovery database use Get-MailboxStatistics.
[PS] C:\>Get-MailboxStatistics -Database RecoveryDB | ft -auto DisplayName ItemCount StorageLimitStatus LastLogonTime ----------- --------- ------------------ ------------- SystemMailbox{0c020be6-3ce2-4eb7-a458-bfadd3171e86} 10 HealthMailbox-EX2016SRV1-Mailbox-Database-1808423380 5269 ...015 11:45:25 PM HealthMailbox-EX2016SRV1-001 4 ...015 11:48:32 AM HealthMailbox-EX2016SRV1-006 3 In-Place Archive - HealthMailbox-EX2016SRV1-006 2 In-Place Archive - HealthMailbox-EX2016SRV1-001 2 ...015 12:02:55 PM In-Place Archive - HealthMailbox-EX2016SRV1-Mailbox-Database-1808423380 2 Alannah Shaw 3710 ...2015 3:57:34 PM Personal Archive - Alannah Shaw 3452 ...2015 3:55:54 PM HealthMailbox-EX2016SRV1-DB05 987 ...2015 1:13:51 PM In-Place Archive - HealthMailbox-EX2016SRV1-DB05 2
The mailbox for Alannah Shaw is available in this database. Let’s look at some different restore scenarios.
Restoring a Mailbox into the Original Mailbox
To restore a mailbox from the recovery database into the original mailbox we can run New-MailboxRestoreRequest with the following parameters:
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw"
If you need to restore to a different folder add the -TargetRootFolder parameter as well.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -TargetRootFolder "Mailbox Restore"
Restoring a Mailbox into an Archive Mailbox
If you need to direct the restored data into the person’s archive mailbox instead you simply add the -TargetIsArchive switch to the command.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -TargetIsArchive Name TargetMailbox Status ---- ------------- ------ Alannah Shaw exchangeserverpro.net/Company/Head Office/U... Queued
Restoring a Mailbox to a Different Mailbox
If you are restoring the mailbox into a different user’s mailbox (and this includes if you have recreated the user’s mailbox to restore into) you will need to add the -AllowLegacyDNMismatch switch to the command.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw to Alan Reid" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alan Reid" -TargetRootFolder "Alannah Shaw Restore" -AllowLegacyDNMismatch Name TargetMailbox Status ---- ------------- ------ Alannah Shaw to Alan Reid exchangeserverpro.net/Company/Head Office/U... Queued
Restoring Specific Folders from a Mailbox
In many restore scenarios you only want to recovery specific folders from the original database. The -IncludeFolders parameter can be used to achieve this. There are two ways to nominate the folder names.
For a personal folder (one that the user themselves created) simply use the folder name, and optionally you can include all sub-folders.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Invoices Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -IncludeFolders "Invoices" [PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Invoices and Subfolders Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -IncludeFolders "Invoices/*"
For well-known folders (such as Sent Items, Inbox, Junk Email) the syntax is slightly different.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Inbox Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -IncludeFolders "#Inbox#" [PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Inbox and Subfolders Recovery" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -IncludeFolders "#Inbox#/*"
Excluding Folders from the Restore Request
You can also exclude folders from the restore, for example the Sent Items or Deleted Items. The syntax is the same as above and uses the -ExcludeFolders parameter.
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw Recovery Excluding Sent Items" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -ExcludeFolders "#SentItems#","#DeletedItems#"
Handling Conflicts
If you’re restoring into a mailbox or folder that already contains items there may be some conflicts. The -ConflictResolutionOption parameter lets you choose one of three options:
- KeepSourceItem (the source in this case is the recovery database’s copy of the item, and this is the default option)
- KeepLatestItem (the item with the most recent modified date)
- KeepAll (allows duplicates to be created)
[PS] C:\>New-MailboxRestoreRequest -Name "Alannah Shaw" -SourceDatabase RecoveryDB -SourceStoreMailbox "Alannah Shaw" -TargetMailbox "Alannah Shaw" -ConflictResolutionOption KeepAll Name TargetMailbox Status ---- ------------- ------ Alannah Shaw exchangeserverpro.net/Company/Head Office/U... Queued
Combining Scenarios
The scenarios above are examples and do not need to be used exclusively. You can combine different features to suit your particular restore scenarios, such as:
- Restoring from Person A’s mailbox
- Restoring to Person B’s mailbox archive mailbox
- Restoring to a folder named “Person A Restore”
- Excluding Deleted Items and Junk Mail
- Allowing duplicates
All of those can be achieved together in a single mailbox restore request.
Monitoring Mailbox Restore Requests
You can monitor the progress and any errors for a mailbox restore request by running Get-MailboxRestoreRequest and Get-MailboxRestoreRequestStatistics.
[PS] C:\>Get-MailboxRestoreRequest Name TargetMailbox Status ---- ------------- ------ Alannah Shaw exchangeserverpro.net/Company/Head Office/U... Completed Alannah Shaw to Alan Reid exchangeserverpro.net/Company/Head Office/U... Completed Alannah Shaw Recovery Excluding Sent Items exchangeserverpro.net/Company/Head Office/U... Completed
[PS] C:\>Get-MailboxRestoreRequest -Name "Alannah Shaw" Name TargetMailbox Status ---- ------------- ------ Alannah Shaw exchangeserverpro.net/Company/Head Office/U... Completed [PS] C:\>Get-MailboxRestoreRequest -Name "Alannah Shaw" | Get-MailboxRestoreRequestStatistics Name StatusDetail TargetAlias PercentComplete ---- ------------ ----------- --------------- Alannah Shaw Completed Alannah.Shaw 100 [PS] C:\>Get-MailboxRestoreRequest -Name "Alannah Shaw" | Get-MailboxRestoreRequestStatistics | Select Status*,Include*, Exclude*,*Transfer*,OverallDuration,CompletedRequestAgeLimit Status : Completed StatusDetail : Completed IncludeFolders : {} ExcludeFolders : {} ExcludeDumpster : False EstimatedTransferSize : 108.6 MB (113,860,874 bytes) EstimatedTransferItemCount : 3721 BytesTransferred : 41.02 MB (43,016,213 bytes) BytesTransferredPerMinute : 0 B (0 bytes) ItemsTransferred : 1557 OverallDuration : 00:02:57.1693947 CompletedRequestAgeLimit : 3650.00:00:00
Removing Mailbox Restore Requests
When completed the mailbox restore request will remain until it is manually removed or until the request age limit has expired. The default age limit is 3650 days (10 years) so you can expect requests to stay around for a long time.
You can specify your own age limit for mailbox restore requests when you first create them by adding the -CompletedRequestAgeLimit parameter and providing a value such as “7.00:00:00” which is 7 days.
Otherwise, to remove the completed restore requests use the Remove-MailboxRestoreRequest cmdlet.
[PS] C:\>Get-MailboxRestoreRequest | Where Status -eq Completed | Remove-MailboxRestoreRequest
Removing the Recovery Database
When you are finished with your data recovery you can remove the recovery database from the Exchange 2016 server. First, dismount the database.
[PS] C:\>Dismount-Database RecoveryDB Confirm Are you sure you want to perform this action? Dismounting database "RecoveryDB". This may result in reduced availability for mailboxes in the database. [Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
Then remove the database.
[PS] C:\>Remove-MailboxDatabase RecoveryDB Confirm Are you sure you want to perform this action? Removing mailbox database "RecoveryDB". [Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y WARNING: The specified database has been removed. You must remove the database file located in E:RecoveryDBDB05.edb from your computer manually if it exists. Specified database: RecoveryDB
Finally, delete the files from the file system on your server to reclaim that disk space.
Summary
In this article I demonstrated the complete end to end process for restoring a mailbox or mailbox items in Exchange Server 2016 using a recovery database. You saw how to create the recovery database, restore a database from Windows Server Backup, and how to run mailbox restore requests to extract data from mailboxes in the recovery database. Finally you saw how to clean up at the end of the restore process.
Can one use New-MailboxExportRequest to export a mailbox from the recovery database to a .PST file?
Really asking about Exchange 2019, however, interesting to know for all Exchange versions.
Hello,
Thank you for the shared a very good link.
I have a question about how to restore one item mail from the RDB Dbs.
thank you
Great article Paul, thank you very much.
I have a question about the deleting of the RecoveryDB. We are restoring several mailboxes from several DBs and we’ve noted that when we reuse the RecoveryDB between restores, sometimes them fails and until we don’t recreate the RecoveryDB it doesn’t work.
Does anyone know how to reuse the RecoveryDB in a safe way?. Everytime i recreate it i have to move the other DBs in my exchange to restart the Information store service, which is a bit tricky
Thank you
Sorry, i’ve just realized there is an article for the service restart thing.
Thank you!
hi Paul,
Is it possible to connect Outlook to a Recovery Database to extract data?
Paul, this site has been one of the best things for my career. It’s gotten me out of some tight jams. Just wanted to say your information has always been helpful.
Thank you.
Legendary! This post is a great source of info for recovery situations. Thanks Paul!
Hi Paul
Great work – as ever! Fantastic coverage.
I’ve just migrated from Ex 2013 to 2019 via 2016 (because of some tricky environmental issues)using this, and I’m so happy!
One gotcha that I came across was not checking that the final destination mailboxes had enough capacity – being set at the default 2GB in Ex 2019. All good in the end, however!
This article is helping me A LOT recovering a crashed Exchangeserver. However, I’m having two difficulties:
– I am getting several “FailedOther” status reports, although it seems an import was performed. Is there any way to get a more detailed description of the status so I can see what the problem was?
– In my recoverydatabase are two mailboxes with the same name… therefore I can not import them on my Exchange 2016 CU11. Is there another way to identify the correct mailbox (not -SourceStoreMailbox) when importing? Otherwise I keep getting a “Mailbox isn’t unique on database RecoveryDB” error
Thanks!
Some xtra info: the mailboxes with unique names were using different maildomains (so they have different default mailadresses) and were located in different OU’s …. maybe this can help
I also have the same situation as you: “I am getting several “FailedOther” status reports”.
Were you able to find more details?
Thanks
hi friends, very good article, I was presented with a situation that we had not contemplated 🙁
We made a migration from Exchange 2010 to 2016 all working OK, but we have backups that were made in the old Exchange 2010 with NetBackup tool, my query is, can I create a recovery in 2016 and inject the data in this DB recovery of 2016? or should I necessarily have a team with Exchange 2010 ?. Thank you very much for the help.
Badly translated
should I necessarily have a SERVER with Exchange 2010 ?
Excellent Article, Really appreciate the effort.
Please help i’m getting the following error when i try to mount the Recovery database:
Failed to mount database “RecoveryDB”. Error: An Active Manager operation failed. Error: The database action failed.
Error: Operation failed with message: MapiExceptionCallFailed: Unable to mount database. (hr=0x80004005, ec=1011)
Diagnostic context:
Lid: 65256
Lid: 10722 StoreEc: 0x3F3
Lid: 1047 StoreEc: 0x3F3 [Database: RecoveryDB, Server: servername2]
+ CategoryInfo : InvalidOperation: (RecoveryDB:ADObjectId) [Mount-Database], InvalidOperationException
+ FullyQualifiedErrorId : [Server=Servername,RequestId=05d676c5-9f0d-44b5-956e-a322fb8886fb,TimeStamp=1/14/2019 4:
40:14 PM] [FailureCategory=Cmdlet-InvalidOperationException] 68BE2212,Microsoft.Exchange.Management.SystemConfigur
ationTasks.MountDatabase
+ PSComputerName : servername
Running eseutil /p followed by eseutil /d solved the issue to me.
Hi Paul,
This really helped me a lot. At first, the users are using Dial Tone database until I saw this blog to recover the database from my failed Exchange Server 2016.
Thanks a lot!
Hi,
Using the example:
New-MailboxRestoreRequest -Name “Alannah Shaw Recovery” -SourceDatabase RecoveryDB -SourceStoreMailbox “Alannah Shaw” -TargetMailbox “Alannah Shaw”
Changing the names accordingly, I am getting the following error when i hit enter.
WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance
of an object.
WARNING: Task module “LoggingModule.OnIterateCompleted” fails with exception “Object reference not set to an instance
of an object.”. This module is skipped. Task execution result should not be affected.
Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [New-MailboxRestoreRequest], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Management.Migration.MailboxReplication
.MailboxRestoreRequest.NewMailboxRestoreRequest
+ PSComputerName :
Any thoughts?
I have exactly the same error on Exchange 2016 CU9 in my test lab, also tried to use GUID instead of DisplayName, did you manage to fix this issue?
Having the same problem with Exchange 2016 in my prod unfortunately. I need to recover single mailbox and cannot complete that task 🙁 Not even sure whether this is an error for the source or the target mailbox 🙁
Nevermind, it seems the target mailbox needs to be identified by GUID and not the display name – then it works fine. Thank you!
Marchin, thanks for sharing the solution, it works for me too, should be mentioned in the article.
Yes, this just solved my problem too – GUID only now, it seems. Used to work with names, so I guess a recent CU has changed that behaviour.
This is a nice article, but you mention that it’s possible to “-includefolders” or “-excludefolders” for multiple folders in a single command — what’s the proper syntax for that?
-includefolders “#Inbox#,#SentItems#” ??
Or does each folder get its own set of quotes around it with a comma in between? MS specifies that the argument is of type System.String so I figured it should be a single double-quoted list with commas, but it’s not at all clear, and there seem to be no examples of this, especially not on MS’s own documentation. [roll-eyes]
There’s an example in the demonstration of excluding folders.
[PS] C:\>New-MailboxRestoreRequest -Name “Alannah Shaw Recovery” -SourceDatabase RecoveryDB -SourceStoreMailbox “Alannah Shaw” -TargetMailbox “Alannah Shaw”
The sourcestoremailbox here is the display name, right? cuz I can’t find the alias or guid in the recoveryDB. And the targetMailbox is also the displayname?
Yes I’m just using display name in that example.
Thank you so much, great article and super helpful!!!
Great article, as usual. Thank You!
Awesome!!! You saved my life … 😀 Thank you very much!
hi Paul,
i’m getting a Mailbox isn’t unique on database RecoveryDB. Any thoughts on that?
thanks!
What are you doing that leads to that error?
Hello Paul,
I think you’ve made a little mistake in the powershell command to exclude folders by “Excluding folders from the restore request”
In the explanation for it you suggest to use the -excludefolder parameter. In the powershell command below you use the -includefolder parameter.
Kind regards,
Ronald Brouwer
Thanks, fixed.
Your’re welcome.