Saturday, April 1, 2017

How to create Recovery database in Exchange 2016 (with Snapshot).

Hello Friends, Today I will show you how you can create a Recovery database in Exchange 2016. Recovery database can be very useful if you want to restore few emails of a user mailbox or want to restore the whole mailbox. Recovery database is a feature in Exchange 2016 which helps us to restore a mailbox from a back up copy of mailbox database. Recovery database allows us to merge the emails of a mailbox from a back up copy of a mailbox database with a mailbox which is currently residing on a mounted copy of mailbox database.

I have an user MSFT , The user had an  important email on his mailbox however the user accidentally deleted all the email on his mailbox now the user wants those emails back.

I have restored a copy of the mailbox database from my back up utility, The name of the mailbox database is mailbox database is "Mailbox Database 1978255080.edb".
I will use the restored mailbox database to restore the deleted emails for the MSFT mailbox.
Run the below command from Exchange Powershell to create a Recovery database.
New-MailboxDatabase -Recovery -Name <RDBName> -Server <ServerName> -EdbFilePath <RDBPathandFileName>






Once the Recovery database is created then restart the Microsoft Exchange Information store service. Run the below command from Exchange Powershell.
Restart-Service MSExchangeIS






We will have to mount the recovery database now however before mounting the Recovery database we will have to bring the Recovery  database in to clean shutdown so that the Recovery database can be mounted.
Run the below command to repair the Recovery database.
eseutil /p "C:\Recovery\Mailbox Database 1978255080.edb"
Note:- My database couldn't be repaired using soft recovery so I have used hard repair switch to repair the mailbox database. You can also use the soft recovery switch to repair the mailbox database.




Recovery database is in clean shutdown, We can check by running the below command.
eseutil /mh "C:\Recovery\Mailbox Database 1978255080.edb"




Run the below command to mount the Recovery database.
Mount-database <Recovery database>




Run the Below command to find out the mailboxes that resides in the Recovery database.
Get-MailboxStatistics -Database <Recovery database>













The mailbox that needs to be restored should show up. We can see that MSFT mailbox is in the Recovery database.
Run the below command to restore the mailbox with name "MSFT" from Recovery database to the user mailbox that has the email address msft@shubh.com.

New-MaiboxRestoreRequest -SourceDatabase Rec_db -SourceStoreMailbox "MSFT" -TargetMailbox msft@shubh.com




Once the command is run, The Restore process will be initiated. We can see here the restore process is in Queued state. We can check the status of the restore process by running the below command.

Get-MailboxRestoreRequest




Now the MSFT mailbox is restored. The accidentally deleted important email is back in the mailbox.






Run the below command to Remove the restore request, This can be achieved using Remove-MailboxRestoreRequest command.
Get-MailboxRestoreRequest -Status Completed | Remove-MailboxRestoreRequest




Note:- A mailbox restore can be done using different attributes, Below is another example to restore a mailbox using different attributes.

You can find out the mailbox GUID using the below command.
Get-MailboxStatistics -Database rec_db |fl DisplayName,*GUID*
and then use the below command to restore the mailbox that has the MailboxGUID 44b7f929-786f-4fd1-a001-db903279b9f3 on mailbox database Rec_db to the target mailbox with the alias MSFT.

New-MailboxRestoreRequest -SourceDatabase Rec_db -SourceStoreMailbox 44b7f929-786f-4fd1-a001-db903279b9f3 -TargetMailbox msft