Exchange Database Recovery – Using eseutil commands
The real job of an exchange administrator is to maintain high availability when it comes to a messaging environment.
Below mentioned processes are not done on a day to day basis, but understanding how the process works is mandatory for every exchange administrator.
###Update###
JET_errMissingLogFile -528 -548 – Exchange 2010 database recovery: https://msexchangeguru.com/2013/02/01/jet_errmissinglogfile-528-548/
You may be also interested in these topics too if you wish to know more about Exchange database technology:
Here I have tried to explain the terminologies involved in a repair process like how the Exchange JET database stores information properly arranged in physical and logical pages and how the repair, defrag and ISINTEG process get rid of corruption.
Bad Checksum on Exchange Database: https://msexchangeguru.com/2009/07/13/checksum-error/
Here, lets look at identifying a checksum error, understanding health of an Exchange database and how to know which log file belong to which database.
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.
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.
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.
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”
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:
11. This folder contains the restore.env along with the logs as indicated below:
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.
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”
14. The command will complete successfully:
15. If you check the folder that contained the restore.env file, we would find that to be empty:
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.
http://support.microsoft.com/?id=317014
21. The process completes successfully.
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”
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.
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.
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.
Best Regards,
Meera Nair
Team @MSExchangeGuru
December 16th, 2011 at 9:04 am
Good Explanation About ESEUTIL.
December 20th, 2011 at 2:58 pm
Very good presentation. Its very easy to understand.Thanks for the same.
December 22nd, 2011 at 5:55 am
Gr8 work. I relay liked this article. Simple and precise.
December 22nd, 2011 at 10:56 am
This is good but only three times we can do repair once third time gets over you cannot do the repair your database is gone for toss. so keep a flat file copy before doing this.
January 31st, 2012 at 5:08 am
Thanks a lot for free useful topics. It was very helpful for me. Though besides this i followed other sites. But this one is great. I have 50 GB data and full process need about 10 hours.
1. Take a copy of main data foler (Exchsrvr) and put it safe place
2. use useutil /mh to test health of database and got dirty shutdown.
3. use useutil /ml to test log file.
4. use useutil /r but it failed
5. use useutil /p for both database mail database and public folder database, successful
6. take a backup of repair database to a other folder for safety.
7. delete all log files and only except 2 edb and 2 stm files
8. mount data store just to check and then dismount
9. i have huge data so i avoid derangement
10. finally use isinteg -s servername -fix -test alltests and successful
Insallah, mail server now working properly.
Gias
February 15th, 2012 at 8:53 am
Very awesome write up. I relay liked this article. Simple and precise.
February 25th, 2012 at 9:12 am
Excellent presentation about Eseutil commands which is very help full Gr8 work.
Nilesh..
March 8th, 2012 at 1:10 pm
Thanks! This saved me.
March 26th, 2012 at 11:49 am
i’m running out of the space and i like to redirect the Temp direction to my other disk.. what is proper command ?
i tried with /t “R:\Recovery”
do i need to give /t “R:\Recovery\recovery.edb” name ? i tried this but it didn’t work.. what am i missing?
April 2nd, 2012 at 2:03 am
Awesome article. Been struggling for a bit on this.
Would have been nice though for a heads up on the time this stuff takes to complete.
Took a full 18 hours (64982.27 seconds) to repair!
1 user had wiped their entire calendar events when they connected their iPhone for the first time through iTunes… I needed to restore just his mailbox from the previous night’s backup.
It would seem that in the question of Mac vs PC, even the devices are at war 🙂
April 5th, 2012 at 1:19 am
Hi Meera,
Excellant document! Every ex.admin has to keep in hand.
Pls post 2k7, 2010 eseutils and high availability
God bless you and give good health to you.
April 9th, 2012 at 7:02 am
the site is so wonderful! to say the least, it did save my job yesterday!
here is the account of my journey
1. Take a copy of main data folder (Exchsrvr) and put it safe place
2. used useutil /mh to test health of database and got dirty shutdown for both priv, and pub
3. used useutil /ml to test log file.(i could not find the required log, and some where damaged)
4. used useutil /r but it failed
5. used useutil /p for both database mail database and public folder database, successful
6. used useutil /d to defragment priv and pub databases,successful
7. still mount failed
8. used isinteg -s servername -fix -test alltests, failed
9. used useutil /g to defragment, successful
10.reused isinteg -s servername -fix -test alltests, successful
11.remount the databases, successful
mail server now working properly.
thanks Meera your are marvelous, my bread is safe at least for now!
April 11th, 2012 at 2:43 pm
[…] 4. Make sure restored database is in the clean state.https://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands/ […]
August 11th, 2012 at 11:07 pm
Great walk through, I have just followed this, and it works great on 2010 too 🙂
August 13th, 2012 at 12:34 am
Really wonderful Meera and Rathish. This is really helped a lot. Once again thanks.
August 28th, 2012 at 5:21 am
I know that commands is working for recover edb files from corrupt and damaged exchange server but they are not recover complete mails from exchange server. Thanks for the great article though.
August 29th, 2012 at 2:50 pm
Thanks a lot for your contribution. I was trying to mount our primary database for around 5 hours, but nothing.
I found this information. And i was able to mount the database.
Thanks again.
September 12th, 2012 at 9:50 am
This is by far the best article I’ve seen regarding ESEutil and recovering Exchange databases. With this article I was able to succesfully restore a corrupted database in Exchange 2007. Thank you very much!!!
September 13th, 2012 at 4:39 am
Excellent article about eseutil.solved my exchange dirty sgutdown problem Thanks.
September 28th, 2012 at 1:14 am
can’t remember the last time i read an article soo clear and helpful. my exchange can finally backup. Cheers!!
October 8th, 2012 at 12:09 pm
it is the best article what ever i have seen regarding Eseutil tool.
Thanks.
S.Shabber(:$
November 22nd, 2012 at 10:06 am
errer – windows detected a hardisk ploblem
Backup your file immediatrly to provent information loss and then contact the
computer manfacturer to delermin if you need to repair or prplace the disk
January 18th, 2013 at 6:11 am
[…] Den planlagte backupen feila, og etter kort tid var serveren fylt opp med loggfiler. Fann ein guide som kunne være løysinga på problemet. Det synte seg at statusen på databasen var “Dirty […]
January 21st, 2013 at 1:10 am
I have just repaired and restored my entire exchange database and remounted them successfully with the advice and procedures in this article, thank you very much for posting
January 21st, 2013 at 8:45 am
Youre welcome Dave…
January 23rd, 2013 at 11:14 am
Thank´s for your info, it was very useful tu repair a DB. Excellent and very precise
February 1st, 2013 at 4:43 pm
[…] Exchange Database Recovery – Using eseutil commands: https://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands/ […]
February 26th, 2013 at 1:19 am
Googled for some Eseutil helps and this link has come up..Excellent presentation..keep it up
March 29th, 2013 at 9:25 am
This has to be one of the most useful pages ever on Exchange – very simple to understand, straight to the point. Found it extremely useful to do a recovery yesterday. The screenshots and examples make it so much better than Microsoft official documentation.
March 31st, 2013 at 11:55 pm
Well explained about Eseutil command
April 15th, 2013 at 3:31 am
I was wondering if you know whether changing priority of eseutil.exe in task manager after it is running will help speed it up or is it not a wise idea to change it from normal?
May 12th, 2013 at 10:34 pm
Excellent document Meera. Thanks for sharing.
June 5th, 2013 at 9:08 pm
Outstanding content! Thanks you saved my a__ today.
Jarmo
July 16th, 2013 at 7:43 pm
very very best document..it has given me a clean and clear idea abt theEseutil cmds..
Thank you very much..
September 9th, 2013 at 12:32 pm
how do you run the ESE defrag util when you have a long file name. I am trying to run the command line and it can not find the DB. I have tried all kinds of variations including 8.3 format but nothing seems to be working for me? Thoughts? Below is the error i receive.
M:\Program Files\Microsoft\Exchange Server\Mailbox\IS6>dir *.edb
Volume in drive M is Database
Volume Serial Number is 4211-5492
Directory of M:\Program Files\Microsoft\Exchange Server\Mailbox\IS6
09/09/2013 12:15 PM 9,733,160,960 Mailbox Database.edb
1 File(s) 9,733,160,960 bytes
0 Dir(s) 10,259,120,128 bytes free
M:\Program Files\Microsoft\Exchange Server\Mailbox\IS6>eseutil /d M:\Program Files\Microsoft\Exchange Server\Mailbox\IS6\Mailbox Database.edb /t l:\temp.edb
Usage Error: Invalid argument ‘Files\Microsoft\Exchange’. Options must be preced
ed by ‘-‘ or ‘/’.
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.01
Copyright (C) Microsoft Corporation. All Rights Reserved.
DESCRIPTION: Database utilities for the Extensible Storage Engine for Microsoft
(R) Exchange Server.
MODES OF OPERATION:
Defragmentation: ESEUTIL /d [options]
Recovery: ESEUTIL /r [options]
Integrity: ESEUTIL /g [options]
Checksum: ESEUTIL /k [options]
Repair: ESEUTIL /p [options]
File Dump: ESEUTIL /m[mode-modifier]
Copy File: ESEUTIL /y [options]
Restore: ESEUTIL /c[mode-modifier] [options]
<<<<>>>>
D=Defragmentation, R=Recovery, G=inteGrity, K=checKsum,
P=rePair, M=file duMp, Y=copY file, C=restore
September 9th, 2013 at 1:05 pm
i got the answer on another site. You need to put the full path in double quotes:
eseutil /d “M:\Program Files\Microsoft\Exchange Server\Mailbox\IS6\Mailbox Database.edb” /t “L:\Mailbox Database.edb”
Defragmentation Status (% complete)
0 10 20 30 40 50 60 70 80 90 100
|—-|—-|—-|—-|—-|—-|—-|—-|—-|—-|
……………………………
September 14th, 2013 at 5:43 am
Really good clear article, the sort you really need to find at 1:00am when the sky is falling in.
Great work.
October 9th, 2013 at 2:54 am
[…] Exchange Database Recovery – Using eseutil commands « MSExchangeGuru.com. […]
October 24th, 2013 at 12:57 pm
[…] Run a check on the database usage ESEUtil or ISInteg […]
December 9th, 2013 at 10:54 am
This was just great>>>>>>>>>>>>>>>>>>>>>>
January 16th, 2014 at 2:30 am
Hi there.
We’ve had a failure resulting in a hard repair. Currently the repair is running at around 6gb per hour, is there anyway to spend this up. We are running exchange 2007.
Thanks
January 18th, 2014 at 6:08 pm
Unfortunately, repair will take this long. 6GB is a good speed. I expect 4-5GB/hour
January 24th, 2014 at 7:13 am
Excellent explanation
February 12th, 2014 at 11:34 am
[…] https://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands/ […]
February 16th, 2014 at 2:16 pm
I had a SBS 2003 server motherboard fail this week. I was able to restore but the store would not mount. I used your guide to fix it.
Thanks!!!!
March 29th, 2014 at 4:41 am
This is the best eseutil explanation i have ever seen. Doing a database softrecovery at the moment, hope this will work, than i can continue repairing the SBS2011 server. Thnx a lot
September 6th, 2014 at 6:56 am
This article really great, all thing is covered. I used it today after a very long time.
Great work.
September 26th, 2014 at 3:02 am
The explanation is very good, and i get this error while doing the hard recovery.
The database is not up-to-date. This operation may find that
this database is corrupt because data from the log files has
yet to be placed in the database.
To ensure the database is up-to-date please use the ‘Recovery’ operation.
Can you please help and suggest.
September 26th, 2014 at 12:40 pm
@Deva
You need exchange disaster recovery expert. Don’t play with the exchange databases, you might end up loosing all emails.
October 17th, 2014 at 7:44 pm
The best explanation ever!!! Kudos!!!