A corrupted exchange database could significantly impact your business. The EseUtil tool offers a simple and quick solution.
A damaged or corrupted Exchange server database enters the ‘dirty shutdown’ state and dismounts. The database fails to mount unless you fix the corruption. Meanwhile, the mailboxes stored in the database are disconnected, and users having their mailboxes in the damaged database lose email connectivity. This situation could affect your business significantly and require an immediate solution.
Exchange extensible storage engine utility or EseUtil is a command-line tool to repair corrupt, damaged or inconsistent Exchange server databases. Exchange administrators also use EseUtil to diagnose database problems and maintain the database’s health.
Using EseUtil, administrators can repair corrupt Exchange databases and restore the mailboxes in events such as uncommitted logs, missing or deleted transaction logs, server crashes, abrupt shutdown, malware, etc. EseUtil helps in situations when Exchange backups are outdated, damaged or not available.
This article discusses the steps to repair a corrupt or damaged Exchange server database using the EseUtil tool and quickly restore the mailboxes.
Steps to Repair Corrupt Exchange Database with EseUtil Tool
The following are the steps to use the EseUtil tool to repair Exchange databases when backups are not available or do not work:
Step 1: Locate the Corrupt Database (EDB) File and Logs
When the Exchange server is set up, the Exchange database (EDB) file is created at the default location:
C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\
However, administrators can store the database file in a different folder or on a different drive volume for performance and other reasons. Therefore, you need to first locate the damaged EDB file to repair it. Similarly, you also need to locate the transaction logs (.log) and the checkpoint file (.chk).
Step 2: Check the Database Status
Check the current database state using the EseUtil command, as follows:
- Press ‘Windows + R’, type \EXCHSRVR\BIN, and click ‘OK’ or press the ‘Enter’ key.
- Click on the address bar and copy the Eseutil.exe location path.
- Open Exchange management shell (EMS) and then navigate to the Eseutil.exe location using the ‘cd’ command.
- Now execute the following command in the powershell window:
Eseutil.exe /mh
Eseutil.exe /mh C:\mbx01\mbx01.edb
The command output will display the database header information. Check the ‘state.’ If it is displayed as ‘dirty shutdown,’ the database is inconsistent or corrupt and requires recovery. If the state is ‘clean shutdown’, the database is in a healthy state and can be mounted to the server with no issues.
Step 3: Back Up the Database Files
After locating and verifying the Exchange server database file, back up the EDB, transaction logs and checkpoint files before using the EseUtil tool. You can back up the database files in another folder, volume or external media.
Step 4: Execute Soft Recovery using EseUtil
When EseUtil is executed with the /r parameter, it is referred to as ‘soft recovery.’ When executed on the corrupt database, the EseUtil tries to commit the transaction logs and restore the database to a healthy state without losing any data. However, it works when there is minor database corruption.
To perform soft recovery, execute the following commands:
EseUtil /r <database file path>
EseUtil /r C:\mbx01\mbx01.edb
This may take a while as it depends on the server’s performance and storage, apart from the size of the database.
Step 5: Verify the Database Status
To check if soft recovery was successful and the database is now in a ‘clean shutdown’ state, execute the following command:
EseUtil /mh C:\mbx01\mbx01.edb
Check the state. If it still appears as ‘dirty shutdown,’ you need to perform a 'hard recovery' to recover the Exchange database.
Step 6: Perform Hard Recovery using EseUtil
Hard recovery should be used only when soft recovery has failed and restoring from backup is not possible. Hard recovery is executed with /p parameter.
[Caution]:
Eseutil/p command purges the irrecoverable data and mailboxes, i.e., removes anything it deems corrupted or unreadable from the database during recovery. Thus, Hard Recovery can lead to significant data loss you might discover later.
When you execute the EseUtil /p command, a data loss warning is displayed, which you need to accept to proceed further.
Therefore, we highly recommend backing up the database before running the EseUtil/p command on the database.
[IMPORTANT NOTE:]
Hard Recovery does not guarantee database recovery (clean shutdown), and you may still fail to mount the database. If the process is successful, we highly recommended creating a new Exchange server mailbox database and move the mailboxes into it. Once this is done, decommission the old recovered database.
You can also use Exchange database repair software, such as Stellar Repair for Exchange, a safer, convenient and effortless way to repair corrupt Exchange databases and recover mailboxes.