Friday, 20 February 2015

Repairing a corrupt mailbox database with Exchange 2007/2010/2013

Using the eseutil.exe tool you are able to repair mailbox databases that may have become corrupted.

We will firstly identify the mailbox database:


If you are using Exchange 2007 or below you must then make sure it is unmounted before we attempt the repair:

Dismount-Database -Identity <database>

** During a database being in a unmounted / failed state log files will remain untouched, but the database mail queue will build up. **

** Make sure database in unmounted and no file locks are on it! **

We can then launch an integrity check on the database:

eseutil /g // Check the integrity of the mailbox database

We can also use the file dump mode that provides us with diagnostics about the database:

eseutil /mh <path-to-db>

If you are using 2010 and above this tool can actually run while the database is mounted (by utilizing the volume shadow copy service.)

    eseutil /mh /vss /vssrec <path-to-db>
** An indication that something is not quite right is the status of the database is in a "DirtyShutdown" state. **
We can now invoke a repair of the database...

You have two options:

- Soft repair: "eseutil /r" which activates recovery mode - which consumes all of the log files (and hence tries to recover data within them):

eseutil /r <logfile-prefix> /d <path-to-database-directory> /l <path-to-database-log-directory>

- Hard Recovery: "eseutil /p" which is used when there are no log files available OR are no in a clean state / corrupted:

eseutil /pd <database-filepath> // Perform repauir process - but don't repair the database, just scan for errors
eseutil /p <database-filepath> don't repair the database

We might additionally want to replay the log files to the database before mounting:

eseutil /r /s <location-of-log-files> /s <location-of-system-files>

And finally mount the database:

Mount-Database -Identity <database>


Post a Comment