Today I had to use Exchange recovery on an SBS 2011 server. It started with the client requesting that the user account be renamed from username "Fred" to a role based name "Pleb". For some starnge reason the user was no longer able to log on after I had renamed the account, so I simply deleted "Pleb" and recreated the accout from scratch. The user then demanded his email back and I thought, easy, just reconnected form the "Disconnected Mailbox" folder in the EMC. Hmm - long face, there was no such folder. It appears that if you create a new account with the same name that an existing account had, the disconnected mailbox is not reccyled or being left - no SBS deletes it. Have to try this on a real Exchange server to check the outcome. Anyway, I was facing a rstore from backup - my first foray into Exchange 2010 recovery!
This SBS server is a VM, and backups are done on the physical server using Backup Assist. When I recovered the the Hyper-V machine, I found the partition with the mailbox data file, but this is slightly different from an actual Windows application image backup on a Exchange server.
I restored the mailbox.edb file to a temp folder, but I had no log files. I fired up the exchange Management Shell (EMS) and ran
Eseutil /mh "E:\Temp\db\Mailbox Database.edb"This command gives you some stats on the DB, the important one being the "State". in my case it was 'Dirty Shutdown', expected but not that desirable. Note to self, need to check with backup Assist support how I can get the log files. Without log files I had to perform a hard repair using:
Eseutil /p "E:\Temp\db\Mailbox Database.edb"
If we have had the log files, we could simple get the "E
Eseutil /r "E03" /l e:\temp\log /d e:\temp\db /s e:\temp\recI then repeated the
Eseutil /mh "E:\Temp\db\Mailbox Database.edb"command, which brought the database back to a state of 'Clean'. The next step now was to bring this recovery database online, using:
New-MailboxDatabase RecDB -Recovery:$true -EdbFilePath "e:\temp\db\Mailbox Database.edb" -LogFolderPath "e:\temp\log" -Server AlphaThis will show the database in the EMC, but it's state is still 'unmounted'. Therefore we issue the command
Mount-Database RecDBwhich mounts the database, followed by the command
Get-MailboxStatistics -Database RecDBwhich lists all mailboxes in my recovery DB. My next step took some time to research as I had two options to consider: a) export the mailbox to a PST fle or b) recover the mailbox back into a users mailbox. Option a) looked quite attractive as I would not have to fiddle with the new mailbox, but it turns out that there are quite a few pre-requisites for doing this. I therefore opted for the second solution, using a command to recover the contents of the backup/recovery database into a special folder "restore" of the user's mailbox:
Restore-Mailbox -Identity "Fred" -RecoveryDatabase RecDB -RecoveryMailbox "Pleb" -TargetFolder RestoreThis caused a prompt to appear, asking for confirmation to import those items into the existing mailbox. Logging on as the user, I did indeed find the new "Restore" subfolder with the desired mail items inside. Phew! What remains to do do is a bit of clean up and house keeping:
Dismount-Database RecDBthen follwoed by
Remove-Mailboxdatabase RecDBand finally
Delete "E:\Temp\db\Mailbox Database.edb"Happy restores!