Thursday, 14 May 2009

Using ESEUTIL to recover and repair exchange databases with dirty shutdown state


There are plenty of guides on using eseutil but getting the parameters right always seems to be a case of trial an error, so here's a quick howto:

1) Copy all the original database and log files to somewhere safe. Then also copy them into a working directory. Eseutil will modify the files in situ so if it goes wrong you don't want your original files modified.

You need to have a copy of the database files (*.edb and *.stm) plus the transaction logs (Exx*.log where xx is a number relating to the information store). The location of the files is available from exchange system manager, but you really should know where they all are anyway.

I'm going to assume the temp directory for the database files is e:\temp\data and they're called exchdb.edb, exchdb.stm. If they reside in the 1st storage group, the transaction logs will be called E00.log (this is the most recent base file) and E00xxxx.log etc (these are the old logs). Lets assume these are copied to e:\temp\logs. You need to replace these with your own paths/filenames of course.

2) Check the database state and expected log files with

eseutil.exe /mh e:\temp\data\exchdb.edb

The output will show a line State: which will be either clean or dirty shutdown. If it's clean, then you don't need this article :)

It will also show which logs are required e.g. which hadn't yet been played into the database when the dirty shutdown occured. If you have any missing then you will have lost email. This generally only occurs if you lost a log drive and have replicated copies of the logs you can use.

3) "Recover" the database. This replays missing transaction logs into the database file - run:

eseutil.exe /r E00 /d"e:\temp\data\exchdb.edb"

You might receive an error that there is an outstanding database attachment. In this case use the /i switch in the command

eseutil.exe /r E00 /d"e:\temp\data\exchdb.edb" /i

4) recheck the database state with the command in 2). If it still shows dirty shutdown you need to repair the database with:

eseutil /p e:\temp\data\exchdb.edb

5) Recheck the database once more and it should show clean shutdown. At this point you should defrag the database

eseutil /d e:\temp\data\exchdb.edb

6) The file is now in a clean state and is ready to be put back into exchange so copy it back to the original location on your exchange server but don't yet mount the file. The last step before mounting the file is to get rid of any remaining errors using isinteg.exe. This tool requires the database to be in the original location on the original exchange server. It needs to be run several times until it no longer reports any errors.

7) Once the database file has no more errors you can now remount it in exchange.

2 comments:

Alex said...

EDB repair has some necessary facilities for solving out given trouble. It can't modify source data of edb file during recovering. The program using modern methods of repairing. The utility is compatible with all software configurations.

Bob Luis said...

At times of severe corruption, the built-in ESE utilities fall short to repair the damaged .edb file. In this situation, only a third party Exchange database recovery tool becomes imperative. Copious Exchange recovery tools are exist in the market which successfully repair and recover all the vital data from the damaged or corrupt EDB files. A veracious third party tool is Stellar Phoenix Mailbox Exchange Recovery that recover all data from damaged Exchange database file effectively and supports all versions of MS Exchange Server.