Exchange Database Recovery – Using eseutil commands
Below mentioned processes are not done on a day to day basis, but understanding how the process works is mandatory for every exchange administrator.
A step by step walk-through of procedure to be followed when exchange database fail to mount in Exchange System Manager:
1. Perform the Eseutil /mh “Path of the database” as indicated below and check the state of the database.

Health of the Database
2. If the state is in clean shutdown, move all the log files from the Transaction logs folder location and then mount the stores.
3. If the state is in Dirty shutdown as mentioned below, check if the log files that is indicated as Logs required is available or now.

Database in Dirty Shutdown
5. To make sure that the log files that is required is in a Clean state, you can perform Eseutil /ml “Path of the log files\log prefix” as indicated below. This command will help you check the health of all the log files in the location.

log file health - eseutil /ml
6.If the log files are healthy, then perform the Soft recovery with the command Eseutil /r <Log Prefix> /l “Path of the log files” /d “Path of the database”

Soft recovery - eseutil/r
7. Once the command completes successfully, mount the stores.
You might get this error:
“Operation terminated with error -1216 (JET_errAttachedDatabaseMismatch, An outstanding database attachment has been detected at the start or end of recovery, but database is missing or does not match attachment info) after n seconds.”
To resolve this, run soft recovery with the “/i ” switch at the end and it will override the EDB-STM mismatch.
How to run HARD RECOVERY:
In case the required log files are not available in a clean state or missing, either restore from a successful back up or perform Hard repair.
8. In case we have valid backup, then we can restore the files.
9. In any restoration software, once the restoration completes, it should create a location containing the restore.env file along with the logs that were backed up without being committed to the database that was backed up.
10. By default, we have the location as C:\Temp as indicated below:

Log restore location
11. This folder contains the restore.env along with the logs as indicated below:

Restore.env Location
12. Make sure we take a copy of the folder containing the logs and restore.env file as the content of the folder will be lost if the hard recovery completes or fails.

Copy the folder post restore
13. In the command prompt, perform the Hard recovery from the BIN folder with the following command:
Eseutil /cc “Path of the restore.env containing folder”
Hard Recovery - eseutil /cc
14. The command will complete successfully:

Hard Recovery completion
15. If you check the folder that contained the restore.env file, we would find that to be empty:

Location becomes empty post Hard Recovery
16. If the backup was taken a few days back and there were logs created in the production location once the backup was done, then we must make sure that the production location contains the sequence of logs from the one in the restore.env location. In this case, the restore.env folder contained the last log file as E0000003.log. If the production location does not contain a sequence of this (i.e. E0000004.log), the hard recovery command will fail.
17. We can use the eseutil /cc “Path of the restore.env folder” /t in order to avoid playing the logs in the production location. (Kindly make sure to take a copy of the folder once again before performing the command as mentioned in step 12. However, in this case, there will be data loss of the mails created after the backup was taken.
18. We can mount the stores successfully.
How to run HARD REPAIR:
19. We can Hard repair the databases, to get them back into a clean shut down state in case we do not have a valid back up. To do so type the command:
D:\Program Files\Exchsrvr\Bin>eseutil /p “D:\Exchsrvr\Mailbox Store (SERVER).edb”
20. When you are prompted to confirm this operation, choose OK.

Pop-up whilst repair
http://support.microsoft.com/?id=317014
21. The process completes successfully.

Repair process completed
How to run OFFLINE DEFRAG:
22. Once Eseutil /p finishes we will need to defrag the databases, to do so type the following command: Note: You must have available hard disk space equal to 110 percent of the size of the database that you want to defragment.
23. To defragment Priv.edb, type the following command at the command prompt, and then press ENTER:
24. D:\Program Files\Exchsrvr\Bin>eseutil /d “D:\Exchsrvr\Mailbox Store (SERVER).edb”

Offline Defrag
25. Note If the private and the public information store databases are large, this step may take some time. When you are prompted to confirm this operation, choose OK.
XADM: How to Defragment with the Eseutil Utility (Eseutil.exe) http://support.microsoft.com/?id=192185
26. Once Eseutil /d finishes Mount the store & Dismount the store immediately then perform the below steps.
How to run ISINTEG:
27. Use Isinteg.exe to fix the Pub1.edb database and the Priv1.edb database. The Isinteg.exe utility runs a test on all areas of each of the databases and reports the results. Isinteg.exe also tries to fix any issues that are encountered.
28. To fix Priv1.edb, type the following command at a command prompt
29. E:\Program Files\Exchsrvr\Bin>isinteg -s (SERVER) -fix -test alltests and choose the store that we are running the command on.

ISINTEG
You are prompted to select the database to be checked.
Index Status Database-Name
Storage Group Name: First Storage Group
1 Offline Mailbox Store (servername)
2 Offline Public Folder Store (servername)
30. Enter a number to select a database or press Return to exit.
31. You can only check databases that are marked as offline. The Information Store service must be started, but the information store must be dismounted.
32. When you select a database, you are prompted with the following message to confirm the selection:
“You have selected First Storage Group / Mailbox Store <servername>
Continue? (Y/N)”
33. Press Y and Enter to start checking the selected database.
34. You receive a summary report that indicates the number of tests that were run, the number of warnings, the number of errors found, the number of fixes attempted, and the time it took for the program to run. If there are any warnings, errors, or fixes, run the command again. Repeat this step until there are no warnings, errors, or fixes reported and the report looks similar to the following text:
Test reference table construction result:
0 error(s); 0 warning(s); 0 fix (es); 0 row(s); time: 0h: 0m: 0s
Test Folder Result:
0 error(s); 0 warning(s); 0 fix (es); 101 row(s); time: 0h: 0m: 0s
Now in test 3 (reference count verification) of total 3 tests;
100% complete.

ISINTEG Completion
Before you execute any command on the database, please make sure that QUICKEDITMODE is not checked in command prompt properties as it may pause the process upon left click.

Quickeditmode disabled
Best Regards,
Meera Nair
October 29th, 2009 at 6:51 am
Of all the eseutil explanations I have seen till date on net, yours one is the best one !!
December 1st, 2009 at 9:58 am
This is the best explanation of the Eseutil commands I’ve ever seen. I’ve never seen any documentation that shows the exact commands in full so I’ve never been able to get them to work before.
December 8th, 2009 at 1:41 pm
This is a very good documentation about Eseutil. i believe Microsoft should see this kind of documentation for their future documentation creation process.
thank you
shanish
March 18th, 2010 at 9:37 am
Hi
In This article you are the best
April 17th, 2010 at 3:52 pm
Excellent description on eseutil. best I have seen. thank you, I will test drive it.
May 13th, 2010 at 10:08 am
Cool!! Great!!!
I like the way your explanation. It’s covering all the details which could require by a good exchange engineer for disaster recovery and I don’t think so anybody will miss to recover the databases after following your steps.
Bravo..bravo!
Now I am moving on next. I am an eager person of exchange but I didn’t get right opportunity to perform. Anyway it doesn’t matter. I will request you to provide some links or documents which will help me to do the troubleshooting on “Exchange Attributes” Level. I show lot of Microsoft guys are solving the problem in second using Exchange Attributes. I don’t where they got those troubleshooting Idea. Most probably they would have got from Microsoft itself.
I also want to do the troubleshooting on Exchange Attributes level but didn’t get right document after doing all Googling.
Thanks & Best Regards
Shambhu ^_^
May 23rd, 2010 at 12:39 pm
[...] Exchange Database Recovery – Using eseutil commands: http://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands [...]
July 13th, 2010 at 1:58 pm
To resolve -1216 error during soft recovery, you should use the following syntax :
eseutil /r /l “Path of the log files” /d
The trick here is to run the eseutil from database directory and to indicate /d parameter with nothing behind. Source : Microsoft Support.
July 21st, 2010 at 5:08 am
Hi,
Well Done job!!!!! I apprectate u r pateience
July 22nd, 2010 at 7:47 pm
Thanks for posting with snap shots. Its very usefull to everone.