Repairing Exchange mailbox database after a hard shutdown

Microsoft Exchange 2003 databases (Mailbox and Public Folders) refused to mount after a hard shutdown caused by a power cut.

Trying to mount mailbox and public folders stores following error popped up:

An internal processing error has occurred. Try restarting the Exchange System Manager or the Microsoft Exchange Information Store service, or both. Examine the Application Log For events related to this error. The description fields of these events will contain specific error codes and may contain links to Microsoft Knowledgebase articles on troubleshooting this problem.
ID no:C1041724
Exchange System Manager


Application Logs recorded errors:

Source: ESE
Event ID: 465
Type: Error
Description:
Information Store (5216) <mailbox store>: Corruption was detected during soft recovery in logfile C:\Program Files\Exchsrvr\mdbdata\E00.log. The failing checksum record is located at position END. Data not matching the log-file fill pattern first appeared in sector 1165 (0x0000048D). This logfile has been damaged and is unusable.

Source: ESE
Event ID: 455
Type: Error
Description:
Information Store (5216) <mailbox store>: Error -1811 occurred while opening logfile C:\Program Files\Exchsrvr\mdbdata\E0000000.log.

eseutil /mh revealed state of the database:
State: Dirty Shutdown
Log Required: 19816-19816 (0x4d68-0x4d68)

Single log file needs to be replayed. Checking state of E00.log file revealed that it’s corrupted –  eseutil /ml:

ERROR: Log damaged (unusable). Last Lgpos: (0x4d68,458,16C). Error -501.
Operation terminated with error -501 (JET_errLogFileCorrupt, Log file is corrupt) after 1.0 seconds.

Trying to do a soft recovery with eseutil /R E00 was unsurprisingly failing:

Performing soft recovery…
Operation terminated with error -528 (JET_errMissingLogFile, Current log file missing) after 1.16 seconds.

Next step was to backup all database and log files and run eseutil in repair mode eseutil /p. (This is destructive method therefore proceed with caution!)

eseutil /p did the trick and database was restored to a clean showdown state. After removing old log files, mailbox store mounted successfully.

It this had failed next step would have been restoring Exchange from last night’s backup.

Most of this also applies to Exchange Server 2007 and 2010