Exchange Server works with a database and all the data is stored in this database, which is in a file format called EDB (Exchange Database). The use of a database rather than a flat file is there to improve manageability, flexibility and secure the data to allow multiple reads and writes.
Likeany other database file, the EDB file in your Exchange Server must be healthy and maintained. This, of course, includes good backup software and periodic test restores. There are many reasons due to which an EDB can get corrupt. In this post, we will be exploring how EDB can get corrupt, and how to can fix it.
An Exchange Server Database can get corrupt by unforeseen circumstances such as a malware application like a virus or a ransomware. Therefore, choosing the correct antivirus for your server is important. You need to find the one which is application compatible. If the antivirus is not Exchange Server friendly, this could hinder the integrity of your Exchange Database.
Since we were talking about the Exchange server friendly applications, we need to also consider the backup software we are using as it also needs to be compatible with the Exchange Server to make a healthy backup of database. If you have all these in check, you might have the element of user errors, sudden loss of power, a corrupted update, or after a restart you found out that users cannot connect to their mailboxes.
Your first action in such matter is to check if all the services of Exchange are up and running andthe server is reachable(maybe there was a network change). Then you need to check the database itself. Depending on your Exchange Server, you need to check if the database is mounted. If not, try to mount it. If you get an error while trying to mount, then there might be an issue with the database.
The only option to check the status of an Exchange Server is by using the EseUtil tool, which is available in all Exchange Servers from 2007 to 2019. If you are still running Exchange Server 2007 or 2010, it is strongly suggested to migrate to a newer version as Exchange Server 2007 has been out of support and end-of-life for quite a while. Exchange Server 2010 support and life ended in January 2020.
To check the status of your Exchange Database, open command prompt as Administrator and run the following command, after going to the respective folder of the EDB file and its logs.
EseUtil.exe /MH or EseUtil.exe /MH
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 of the database. 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 a third-party software, missing log file, 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 which 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, 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.