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:\RecoveryDB\DB05.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.
This article Restoring Exchange Server 2016 Mailboxes and Items Using a Recovery Database is © 2015 ExchangeServerPro.com
Get more Exchange Server tips at ExchangeServerPro.com