Recently one of our clients had an unexpected shutdown on one of their Exchange 2010 mailbox server, as the DAG was not in place this shutdown caused couple of Mailbox database go corrupt, now this is the situation no administrator wants to see but should be ready to recover from as fast as they can.
In this Situation we recovered DB from the last full back, and Replayed deferential logs using Eseutil tool and restored the Service.
I have tried to simulate this situation in my Test Lab and below are the steps we used in recovery procedure. You can follow the same step to practice the same or to recover DB from the similar situation.
We need a good full backup of DB we wants to restore so make sure full backup is available and tested periodically to check integrity of the same.
To do a test in Lab I took a full back of DB using windows backup tool, best would be to use the same backup and Restore application you are using in production.
Once you have taken full backup of Exchange Databases, Generate some Load on Database.
In Test lab I created a DL for the DB added everyone from that DB in DL and sent around 500 emails to DL via PowerShell script to have some good amount of logs and data generated on DB.
You can find the PowerShell command I used to generate load end of this document.
Now next step is to dismount the database and delete the exiting edb file in Database, Once the EDB file is Deleted, Copy all the logs to a different location.
Now restore the DB, we just need EDB file from the last full backup, if you restore the logs too you can copy them to a different location and empty the logs DIR, Once the EDB file is restored from the last full backup copy the file to a different location so in case the file gets corrupt while we relay the logs we can reuse the EDB file.
Next we need to check state of the restored database it should be in Dirty Shutdown,
Note: to replay logs to DB it should be in dirty shutdown state, you can’t Replay Logs to clean shutdown state EDB database file.
I Used the below command to check the EDB file State.
Eseutil /Mh “Edb file path”
So now we have database restored, let’s replay logs from log folder to bring it back to the original state.
Note: We will use logs we copied to a different DIR before full back restore.
The complete syntax for the Eseutil.exe soft recovery function, listing all possible switches, is:
ESEUTIL /r enn
/L [path to log files]
/s [path to checkpoint file]
/d [path to database file] /i
Example:
ESEUTIL /r e00 /Lf:\LOGDIR /dg:\EDBDIR /i
The Command I ran is visible in the Screenshot, once you run the Command it will start Replaying logs and will restore the DB.
Now wait for recovery to finishes it may take some time depending on data.
Once the Recovery is done successfully you can check the DB state and it will be now in Clean Shutdown.
Below is he screenshot of same DB after log replay.
Now you can mount the database.
While you are replaying logs and status is not complete successfully make sure the DB is not mounted automatically, sometime its happens active manger mount database automatically before the successful message appear.
This complete the soft recovery exercise hope you like my article.
Below is the PowerShell one liner Scrip I used to Generate Load on DB in My Test lab.
1..500 | % { Send-MailMessage –to AllusersDB1@LetsExchange.in –from Admin@LetsExchange.in –Subject “Test Message – Backup Restore Testing” –SmtpServer smtp.LetsExchange.in }
Comments
Post a Comment