Exchange Server stores all the data in a proprietary file format called EDB. This means that all the mailbox items, including emails, contacts, notes, journals, and other user details, are stored in one file. Unfortunately, the Exchange Server mailbox is vulnerable to data corruption that may be caused due to various factors, such as sudden power loss, a bad patch installation, conflicting third-party software, human errors, or the drive is full.
So, you need to first identify whether there is corruption in the mailbox or not. To see the state of databases, you can use the ESEUtil with the /mh parameter. If the database is in a Dirty Shutdown state, the mailbox will not mount.
In such a case, you need to run the Soft Recovery by using the ESEUtil with /r option (as given below).
When this operation is completed, re-run the ESEUtil with the /mh option to check the state of the database. If the state is still in Dirty Shutdown, then the only option is to run the Hard Recovery. It is to be noted that Hard Recovery will literally crop off any data which is deemed corrupt and there’s no guarantee that the database will mount after this operation. You will need to confirm that you understand and accept data loss after the operation. So, if the damage is small, you could end up with only some items missing. However, if the damage is considerably worse, you could end up missing the entire mailboxes or folders.
To perform Hard Recovery, run the ESEUtil with /p option.
Eseutil /p DB2.edb
After running the command, you will be asked if you accept data loss.
Once you press the OK button, the process will start and there is no way to go back.
There are some things to consider while running the Hard Recovery:
After the recovery - be it Soft or Hard, it is highly recommended to run defragmentation of the database by using the /d option.
Eseutil /d DB2.EDB
In the above example (see image), the defragmentation has been completed in a few seconds as the EDB file is 250 MB only, with barely a few mailboxes in it. However, the process will take a considerable amount of time in a real scenario.
The defrag process will remove any unwanted space from the database. You can check the size of the database and unwanted white space, by running the following command. Here, the available space is the extra space.
Get-MailboxDatabase -Status | ft name, databasesize, availablenewmailboxspace -auto
The process mentioned above tries to recover the corrupt databases. Now, you can follow the below-given process to scan and repair corruption in individual mailboxes. For this, you need to run the PowerShell cmdlet New-MailboxRepairRequest as given below.
Note: The New-MailboxRepairRequest is not capable of repairing database corruption. It is ideal to be used against a specific database or databases.
New-MailboxRepairRequest -Mailbox kyle -CorruptionType ProvisionedFolder,SearchFolder, AggregateCounts,Folderview
This cmdlet will go through the mailbox and check if there is any corruption in every point as specified in the Corruption Type.
Note: If you have got an archive mailbox, you need to add the -archive option at the end of the command.
There is only one way to monitor the repair process. You need to go to the event viewer and look for the following information, under the Applications and Service Logs and under the MSExchange Management log.
If the process is marked as succeeded, the next step is to go to the Application logs and look for entries with the event IDs 10047 and 10048. These events signal the start and end of the execution and show the errors that have been encountered if any.
ConclusionBefore performing the above operations, it is recommended to take a backup of the mailbox or of the whole database as there are chances of data loss and there is no possibility of recovery. In such a situation, the recovery time would be huge and the administrative efforts will be substantial. To avoid such hassles, you can use commercial applications 'ou of the box'. With these types of applications, you can open a corrupted EDB file. They typically support EDB files of all Exchange Servers, from 2003 till 2019. You can export the recovered data to PST and other familiar formats. You can also export directly to a live Exchange Server database or Office 365 tenant.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.