Last Update: Jul 01, 2024 | Published: May 28, 2024
In this guide, Bharat Bhushan shows you how to diagnose and resolve an Exchange dirty shutdown error and help you to bring the Exchange database back to a clean shutdown state.
Thanks to Stellar Info for sponsoring this post.
The Exchange Server logs serve as the backbone of data integrity and disaster recovery in Exchange Server. The server log files maintain and record every database transaction. These log files are then committed to the Exchange database. This ensures a proper activity trail within the database. In fact, this meticulous recording process ensures that the database, in the event of a disruption, can be restored to its last consistent state by replaying the logs.
However, sometimes, the log files are not committed to the database for various reasons. In such cases, the database gets dismounted and displays the Dirty Shutdown error. The Dirty Shutdown issue occurs when the Exchange database has not been closed properly and the transactions recorded in the log files are not committed to the database. This can potentially lead to data loss and email service disruption.
Following are a few reasons which can lead to the dirty shutdown of the database:
You can use the EseUtil – a command-line tool – to diagnose database problems, such as dirty shutdown, and bring the database back to a healthy state. Follow the steps below to effectively troubleshoot and resolve the Dirty Shutdown error in Exchange Server 2010, 2016, and later versions.
Before proceeding, ensure the following:
First check the status of database.
cd C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Mailbox Database 1652432627
eseutil /mh [database file path]
For instance:
eseutil /mh “Mailbox Database 1652432627”
This will display the state of database —whether it’s in the dirty shutdown or clean shutdown state and the details of the uncommitted logs.
Before replaying the uncommitted log files or transaction logs to restore the database to the Clean Shutdown state, you need to check the integrity of the log files. This will help verify the consistency of the logs. First run the below command:
cd <path to the log folder>
Then, run this command:
eseutil /ml <log prefix>
For instance,
eseutil /ml E00.log
If the output displays ‘No damaged log files were found,’ you can proceed to Step 3. Otherwise, you will need to perform a Hard Recovery (discussed in Step 4).
If the log files are intact, you can perform a Soft Recovery on the Exchange database in the dirty shutdown state. In a Soft Recovery, you manually replay the uncommitted logs or transaction logs on the database to bring it back to the clean shutdown state. The command is as follows:
eseutil /r [log prefix]
Replace [log prefix]
with the actual log prefix, such as E00 mentioned in Step 1. After running the command, check the output. If it displays a successful repair message, check the database state using:
EseUtil /mh [database file path]
If the state is displayed as Clean Shutdown, the database is recovered and it is ready to mount. You can mount the database via the Exchange Admin Center or using the Mount-Database PowerShell cmdlet.
If the soft recovery fails or you are still not able to mount the database, you have no other option but to perform a hard recovery on the database. However, this ‘Hard Recovery’ process can be risky and it may result in data loss. It works by truncating the changes in the database that were not committed by the log files. So, any emails sent/received, or changes made to mailboxes saved in the database that were recorded in the log files, will be lost permanently beyond recovery.
The command to perform a hard recovery is as follows:
eseutil /p [database file path]
For instance,
Eseutil /p <DBFileName.edb>
When you run this command, you must accept this warning message.
If you click OK, EseUtil will go ahead and perform a hard recovery on your Exchange database.
Depending on the size of the database and system specifications, this may take a while to complete.
Caution:
Performing a hard recovery comes with multiple risks. These include:
Therefore, it’s recommended to opt for advanced Exchange recovery software, such as Stellar Repair for Exchange. This software can repair severely corrupt Exchange databases without the risk of data loss. It does not require log files. You simply need to choose the corrupt or unmounted database file, scan it, and then restore the mailboxes to individual PST files.
You can also export mailboxes directly to Office 365 (Microsoft 365) mailboxes or a new database on your live Exchange Server. This way, you can quickly restore users’ mailboxes and mailbox connectivity— thereby avoiding extended downtime.
After you have recovered the database from a dirty shutdown state to a clean shutdown state —whether by soft recovery or hard recovery— it is recommended to check database consistency to ensure it is in the clean shutdown state:
eseutil /mh [database file path]
Follow the guide above to safely recover your Exchange Server database from a dirty shutdown state. Avoid a hard recovery as it can result in data loss. Alternatively, you can use advanced Exchange database repair software, such as Stellar Repair for Exchange, to recover mailboxes from a corrupt or damaged database and save mailboxes to PST format. This way, you can avoid data loss and safely restore all mailboxes by importing the PST files into a new database in Exchange Server.
The software also provides an option to directly import the mailboxes recovered from the damaged database to a live Exchange Server or Microsoft 365 (Office 365) account in a few clicks.
Q. How long does it take to perform a soft recovery?
A. The duration varies, depending on the database size and system performance.
Q. What should I do if hard recovery fails?
A. If hard recovery fails, consider restoring the database from backup or use advanced Exchange recovery software, such as Stellar Repair for Exchange.
Q. Can I prevent this error permanently?
A. While it’s challenging to prevent all errors permanently, you can follow the best practices below to significantly reduce the risk of errors and data loss.
Related articles on Petri.com
How to Fix Exchange Database Failed to Mount Error?