Restore Mailbox after Mailbox Clean has removed Disconnected Mailbox

We have recently had an issue where we needed to bring back a mailbox and export it to .PST after the Exchange mailbox cleanup agent deleted the disconnected mailbox.

First we had to bring the files back from tape.  We used CommVault, and did a Restore to Non-Exchange Location <Out of Place, No Recover> – The database will be restored to the specified location and the logs will not be replayed.

We now have the files restored on a different drive than the original mailbox database was on,  all we need to do now is create a new Recover Database, and then point it to the files that were restored.

Once the files are there, you will need to bring them into a state that allows for you to mount them.  There are a couple of ways to do this.  Instead of giving the details here, you can go to this BLOG for details:

In this case, I was getting a JET error Operation terminated with error -1216 (JET_errAttachedDatabaseMismatch, An outst anding database attachment has been detected at the start or end of recovery, bu t database is missing or does not match attachment info) after 16.661 seconds.

Because I am only worried about creating a .PST file of a old mailbox, and do not wish to restore any other data, I did the Hard Recovery.  If I were restoring this database to be moved back into production, I would trouble shoot the error first.  I am only using the hard recovery option because this database is not going back into a production environment, and the loss of the log files is an acceptable risk.  NOTE: This process could take a long time.  The mailbox database I ran the command on was 103 GB in size, and it took 2395.255 seconds to run the command.

Once you can run the eseutil -mh on the database and have it return a Clean Shutdown state, then you are ready to create your recovery database, mount it, and then export the mailbox you are looking for.

To create the mailbox database, you need to use the new-mailboxdatabase command with the -recover switch.  Here is the command I used because the .edb file and log files were restored to s:\restore\ location.

new-mailboxdatabase -Recover -Name RDB1 – Server prexmb01 -EdbFilePath s:\restore\ex10-ms03.edb -LogFolderPath s:\restore\logfiles

You will also need to create a recovery mailbox, it cannot be in the recovery database.  I have a TempDB database that I use for things like this an legal discovery if needed.  I just created a recovery mailbox for that user.  It will be needed in the next step when you use the new-mailboxrestorerequest command.

You can find more details by going to Microsoft’s site.  I will use the commands I used in below.

First, you need to get the MailboxGuild.  I used the following command.

Get-MailboxStatistics -Database RDB1 | Where { $_.DisplayName -eq “USERNAME” } | Format-List LegacyDN, DisplayName, MailboxGUID, DisconnectReason

You need the following info from the display:

MailboxGuid      : f5b9e238-1095-4a96-be24-1ab89e939506

Then you can use the new-mailboxrestorerequest to get the email from the recovery database and import it into the temp database.

New-MailboxRestoreRequest -SourceDatabase “RDB1″ -SourceStoreMailbox f5b9e238-1095-4a96-be24-1ab89e939506 -TargetMailbox recovermailbox -AllowLegacyDNMismatch

Notice that I added the -AllowLegacyDNMismatch so that you don’t have to have the new mailbox you are restoring to have the same LegacyExchangeDN or X500 proxy address as the mailbox you are recovering.

You can check on the progress of the restore by using the Get-mailboxrestorerequest command.   It should go from a status of Queued, to InProgress, and then to Completed.

At this point, you can then use the new-exportmailboxrequest to create a .PST file.  You can find more details on this command in a previous blog post that I did.

To export the mailbox, you then use the new-mailboxexportrequest command.  I used the following command:

New-MailboxexportRequest -Mailbox USERNAME -FilePath “\\mkiefferex\exld$\USERNAME_10-30-2010_1505.pst” -MRSServer prexchu01

You can check on the status of the export request by using the get-mailboxexportrequest.  The status should change from Queued to InProgress then to Completed.

Once it has completed, you can then copy the .PST to a file share, CD or DVD to give to the user that requested the mailbox restore.  NOTE:  I LEARNED THIS THE HARD WAY.  If you try to copy the file and it says the file is still in use, DO NOT terminate or close the connection that is accessing the file.  If you go and look at open files on the computer the .PST file was copied to, you will see the file is open by the client access computers admin user.  If you close the connection, it WILL damage the .PST file and you will not be able to use it.

Clean-Up – Don’t leave stuff that is unneeded in your Exchange Org.

When you are done, make sure you do the following.

  1. Delete the Recovery Mailbox Database.
  2. Delete the files that were used for the restore and the Recovery Mailbox Database.
  3. Delete the user you recovered the email to.

One comment

  1. bic4 Intranet says:

    Exchange Mailbox Restore

    Exchange Mailbox Restore