Extensible Storage Engine Utility or EseUtil is a built-in tool that helps Exchange Server administrators to deal with corrupt, inconsistent, or damaged databases. They can use EseUtil commands to optimize the database and server performance. For instance, using the EseUtil /d command can help get rid of White Space (space left by deleted mailboxes or mail items) from the database to reduce its size.
Similarly, the EseUtil /MH command lets the administrator run a check on the database to verify its status, i.e., whether the database is in Clean Shutdown or Dirty Shutdown state. When in Clean Shutdown state, the database can be mounted back even if it has been dismounted due to some temporary issue with the server. However, if the database state is displayed as Dirty Shutdown, it indicates that the database is inconsistent, damaged, or corrupt.
In this article, you will learn the steps to use the EseUtil /MH command to check the database state and other commands to restore the database from Dirty Shutdown state to Clean Shutdown state.
Steps to Use EseUtil MH Command to Check Exchange Database State
You can use the EseUtil command on offline databases. If any database (.edb) file dismounts from your Exchange Server, you can run the EseUtil /mh command to check the database state by following these steps:
Step 1: Find the Offline Database Name
Open the Exchange Management Shell (EMS) and run the following command:
Get-MailboxDatabase –Status | Sort Name | ft Name, Server, Mounted
This will list all the databases on your Exchange Server with their mount status. Note down the name of the database(s) that shows a False value under the Mounted column.
Step 2: Check the Exchange Database State
The databases with FalseMounted status are not mounted and are offline. You must check the database state before trying to mount them on the server using the EseUtil /MH command.
The EseUtil provides a bunch of information on our Exchange Database file. However, the most important thing to check is the state of the database, which is shown below.
The Dirty Shutdown is an indication that the database is corrupted or there are missing log files. Both the State and the Log Required entries should be checked. The database might not be mounting for a number of reasons like, the database is locked by third-party software, missing log files, corruption, and other. If the database is not mounting because the file is locked by another application, usually removing the lock will change the database state to Clean Shutdown. If no damage was done, the database would mount with no issues. If this is not the case and the database is in Dirty Shutdown, there is only one fix which could help- the EseUtil.
To get more information on the EseUtil and all the parameters it offers, run the given command: EseUtil /?
So, we have the database in dirty shutdown. Before changing this state, it will be impossible to mount the database. In this case, you have two choices. Either restore from backup or you will be losing all the work and emails from the last backup to when the server stopped or use the EseUtil command and try to restore the database in a healthy state. Without losing any data and for minor corruption situations, we can use the eseutil/r option for a soft recovery. But still if your database does not mount, you need to use the /p which is a hard recovery. This can be only used in cases when everything has failed. The /p option will automatically purge any corrupted data.By doing this, you must also accept data loss. In addition, you must also take into consideration that this is not 100% guaranteed that the process will be successful. Your database can still not mount. It's strongly suggested to take a backup of the database before running the /p. This is to ensure that if anything is purged from it, you can still extract data from the database.
One thing to keep in mind is that after you run the /p parameter, a hardcoded record is kept in the database that a hard recovery is made. If you request Microsoft to assist in recovering your database after you run the eseutil/p parameter, Microsoft will not help you.
Another thing to do here is that you need to ensure that there is enough space on the server where the EDB is hosted. It's suggested to have space, almost the size of the database, free in the hard drive or storage.
After you run the command EseUtil /p "myedbfile.edb" you will get the following warning.
Once the command is executed, the process will take a considerable amount of time to finish, depending on the size of your mailbox.
After the task is complete, you need to run the command again using the /mh parameter and ensure that the state is Clean Shutdown.
The alternative solution, when having a database that cannot mount and after executing the /mh parameter, to see that the database state is in Dirty Shutdown, is to use Stellar Repair for Exchange.
Exchange Server Recovery Software can open corrupt databases from any Exchange Server Edition, and recover data from them including mailboxes, emails, calendar entries, contacts, calendars journals, and tasks. The software can also recover Public Folders. It can repair multiple large EDB files and export them directly to a healthy live database or Office 365 tenant. It reduces the time of recovery, with minimal administrative effort.