Summary: Extensible Storage Engine Utilities or EseUtil is a command-line tool that is used to resolve problems and issues caused by database corruption. It’s a quite useful Exchange tool for administrators as it helps them perform various Exchange database maintenance and repair tasks, such as database integrity check, defragmentation, reduce database size, and fix or recover corrupt database files. In this guide, we’ve discussed EseUtil in detail and the steps to use it for Exchange database repair and various other maintenance tasks.
Exchange database (EDB) recovery is often required when the database is dismounted from the server or becomes inaccessible. This may occur due to several reasons, such as server crash, force or abrupt shutdown, virus or malware intrusion, or software and hardware failure. Recovery from a corrupt or damaged database can be a tricky situation, depending on the level of damage. In Exchange Server, Microsoft provides a native command-line tool called EseUtil that helps check the status of a database and perform a soft or hard recovery. It also helps restore an EDB file for Dial tone recovery and recovery databases (RDB).
Hard recovery is required when soft recovery fails to repair the database on the server. However, with hard recovery, you must accept data loss as this process purges all corrupt or irrecoverable data from the database permanently. Thus, it’s not recommended to perform hard recovery. Instead, you can use Exchange recovery software to repair the Exchange database without any data loss. The software also recovers accidentally deleted mailboxes and mailbox items during database repair.
Exchange Database File Location
By default, the database is created at the following location when Exchange is installed.
C:\Program Files\Microsoft\Exchange Server\Vxx\Mailbox\<database>
Here, Vxx represents Exchange version.
At this location, besides database file, following files are stored,
- The Exchange Mailbox Database File
An Exchange database (.edb) file stores all mailboxes and data on the server. You may change the database name or location by using Exchange Management Shell (EMS).
- Log Files
A log file, such as E001.log, holds the transaction records, which are performed on the Exchange.
- Check Point File
A checkpoint file, such as E001.chk, is used by Exchange server to keep track of relation between the database and log files.
- Reserved Log File
These are .jrs format files, such as E00res0001E.jrs, used by Exchange to hold transaction logs when a situation, such as disk full, occurs. It checks the available disk space before committing the changes from log files to database.
- Temporary Log File
A temporary log file, such as E00tmo1.log, is used when a new log file is created.
To perform different Exchange maintenance and repair tasks on an inaccessible, corrupt, or damaged database, you can use the following EseUtil switches,
|Eseutil /D||Defragments the offline database file. Helps reduce the overall size of the Exchange database on disk and optimizes the database file for performance. Also helps keep a check on the database health.|
|Eseutil /R||Allows you to restore the database. It replays the transaction log files to bring the database from Dirty Shutdown or inconsistent state to Clean Shutdown or consistent state.|
|Eseutil /C||Performs hard recovery and displays restore log files of the database.|
|Eseutil /M||It displays the header information of database files, logs files, & checkpoint files. It also shows the database space allocation and page header information with metadata.|
|Eseutil /P||Repairs corrupt or damaged database. It removes the pages that can’t be repaired. This can lead to data loss as it removes severely damaged content from the database.|
|Eseutil /G||Used to perform integrity checks. It verifies page level and ESE-level database integrity checks to detect specific inconsistencies with the database.|
|Eseutil /Y||Copies large files such as Mailbox Database files fast.|
|Eseutil /K||Performs checksum tests to verify pages in database file, transaction log file, and checkpoint file.|
|Eseutil /MH||Displays database state, i.e. Dirty Shutdown (Inconsistent) or Clean Shutdown (Consistent)|
Prerequisites to Run EseUtil
Before you run EseUtil to verify, modify, or repair Exchange databases, you must ensure the following prerequisites,
- Backup Exchange database file
- Administrator access or permissions
- Free storage space (at least 1.2 times of database size)
Steps to Use EseUtil for Exchange Database Repair
Below we have discussed the steps and requirements to use EseUtil for repairing the Exchange database.
Step 1: Locate EseUtil
To use EseUtil, you need to find it. You can find the EseUtil.exe utility in the Bin directory of your Exchange installation. For instance, if you have installed Exchange 2013 or 2016 in C: drive volume, you can locate the EseUtil at the following path,
C:\Program Files\Microsoft\Exchange Server\V15\Bin\
After verifying the path, open the command prompt as administrator and then change the directory path to the EseUtil location by using the following command,
cd C:\Program Files\Microsoft\Exchange Server\V15\Bin
However, if the EseUtil path is added to the Environment Variables list, you can launch the Command Prompt directly from any location and run EseUtil commands.
Step 2: Check Database Size
If the database size is 10 GB, open the 1221 event ID to check whitespace in the database. Once known, subtract the whitespace database size from the total database size. That’s the minimum storage space required to use EseUtil for Exchange database repair.
Step 3: Check Database State
To identify the database state, use the /MH switch. If the state is displayed as Clean Shutdown, there shouldn’t be any issues and the database can be easily mounted after moving all the log files to a different location.
However, if the database is in Dirty Shutdown state, the database won’t mount. This indicates an inconsistent or corrupt database. This may occur due to missing or deleted log files and when log files are not committed to the database.
The command to check database consistency or state is as follows,
eseutil /mh <database file name>
Step 4: Check Logs
If your database is in Dirty Shutdown, you will see another line under it, which mentions the log file that is required. The next step is to check if the logs are healthy or if there is a problem with the logs. To do this, use the ML prefix with EseUtil and the log path that you can copy from the Log Required section of the report.
eseutil /ml "M:\mbx01\logs"
This will display the status of logs. If all logs are healthy, you will get a message saying “No damaged log files were found.”
Step 5: Perform Soft Recovery
When the logs are healthy, you can perform soft recovery by using the EseUtil /r parameter.
Eseutil /r e00 /l "M:\mbx01\logs" /d "M:\mbx01\database"
Once this process is done, you can recheck the database state by using the Eseutil /mh command and then mount the database by using the Mount-Database cmdlet. The repair process may take a while to finish, depending on the damage or size of the database.
Step 6: Perform Hard Recovery
If you still get errors and the database remains in a Dirty Shutdown state, then try to repair the database via hard recovery. But before doing this, you must know that this repair process will purge any data that EseUtil finds as damaged. You need to consider and accept data loss that hard recovery will cause, irrespective of the damage.
To run hard recovery, use the eseutil /p command. Besides, enough storage to process the database, hard recovery could take a considerable amount of time. Also, once you start, you will be reminded about the damage. You must accept the Warning to proceed and repair the Exchange database via EseUtil’s hard recovery.
Once done, use the IsInteg tool for Index Repair. IsInteg is a repair only utility that understands relation between tables and records and turns them into folders and messages. The tool is located at the following location,
C:>Program Files>Exchsrvr> bin
Then run the IsInteg test by using the following command,
Isinteg –s <server_name> -fix –test alltests
You may repeat the command multiple times to get rid of errors. Once errors are fixed, you can mount the database.
Further, you can use New-MailboxRepairRequest, if you have Exchange Server 2010 with SP1 or later versions, before mounting the database on the server. One more thing, you cannot stop the process once it started. If you stop it anyway, it may cause even more damage to the database. However, if all goes well, you will be able to mount the database.
Points to Remember Before Using EseUtil for Exchange Database Repair
You must remember the following important points before using the EseUtil:
- EseUtil is not a fool-proof utility. It may fail and cause more damage or data loss based on the recovery method you choose and the level of database corruption.
- It’s not necessary that you will be able to mount the database after recovery.
- Depending on the size of database and the level of damage, your users will not be able to receive, send, or work with their mailboxes during the EseUtil database repair process. This could lead to several hours of downtime and may cause damage to the business.
Alternatively, you can use Stellar Repair for Exchange to do the job effortlessly and in much less time. The application can open a corrupt EDB file from any Exchange Server version. You can then repair the database. It also allows you to perform a granular search with search filters.
The software help extracts mailboxes and saves them in PST format when the database is damaged with no possible way to fix it. This can help avoid downtime and restore user mailboxes so that business can continue. You can also use this EDB Recovery Software to import mailboxes from an EDB file directly into a live Exchange Server database with an automatic mailbox match option.
Besides PST, Stellar Repair for Exchange can also export mailboxes and mailbox items to other file formats, such as EML, PDF, MSG, HTML, & RTF, and directly to an Office 365 account.