How to Recover an Exchange Database from “Dirty Shutdown” State?

 

In Exchange Server, a transaction is considered committed when Exchange applies the transaction recorded in the transaction log to the mailbox database. These transactions are the user-generated database operations, such as sending, receiving, deleting, or modifying emails in the mailbox. 

If all the pending transactions are committed before the server shuts down, the database enters a clean shutdown state. In case a shutdown occurs before all the pending transactions are committed, the database enters a Dirty Shutdown state. 

As a result, the database becomes inconsistent and inaccessible, requiring immediate fixing to continue the normal functioning of your business. Continuing with the discussion, this blog attempts to find workable manual and automated ways to recover a database from a Dirty Shutdown state.

What are the reasons behind the Dirty Shutdown state?

The Exchange database might encounter the Dirty Shutdown state for numerous reasons:

  • Outdated Exchange server version
  • Failed or interrupted Exchange server updates
  • Incorrect mounting of the EDB file
  • Less storage space in Exchange
  • Exchange cannot locate the required transaction log files
  • Transaction log files are damaged or corrupted
  • Malware or a virus attack on the server
  • The Exchange server cannot access or read EDB files
  • Sudden system shutdown due to a power outage
  • Failure of storage subsystem
  • Hardware overload due to an external application, causing an abrupt system shutdown


What are some common Exchange database Dirty Shutdown state errors? 

When using Exchange 2010, 2013, 2016, or 2019, you are likely to come across several issues related directly or indirectly to Dirty shutdown:


Error

Error Message

Description
JET_errDatabaseDirtyShutdown (-550) Database was not shutdown cleanly. Recovery must first be run to properly complete database operations for the database. The Exchange database is in a Dirty Shutdown state
MapiExceptionDatabaseError The database couldn’t be mounted because it is in an inconsistent state. Exchange fails to mount a database due to a Dirty Shutdown state.
Database State State: Dirty Shutdown Detected by running eseutil /mh command on the .edb file.  
MapiExceptionCallFailed Unable to mount database (hr=0x80004005, ec=-550) Exchange fails to bring the mailbox database online because of the dirty state.
JET_errRequiredLogFilesMissing (-543) One or more required log files are missing Exchange fails to recover the database because of missing transaction log files  

 

How to recover the Exchange Dirty Shutdown state?

One common way to recover the Exchange in case of a Dirty Shutdown is to use the ESEUTIL, the in-built utility. The command-line tool performs soft and hard repairs to execute this task. The process can cause extensive data loss during hard repair. Hence, administrators consider it the last resort for Exchange recovery.

Before opting for the Eseutil method, several crucial points are worth considering.

  • Make sure to have a healthy backup of the Exchange database file taken recently
  • Also, ensure to back up streaming media files and the log files
  • The Exchange server should have ample space to carry out the Eseutil recovery task

How to Recover the Exchange database from a Dirty Shutdown state by using ESEUTIL?

The steps are as follows:

1. Find the database state 

Determine the current database state by using the following ESEUTIL command:

Eseutil /Mh <Database-Name>

This command will find out if the database is in a clean or dirty shutdown.

2. Check log files

If the command fetches Dirty Shutdown status, you will see another line, ‘Log Required’ just below the state, as shown in the screenshot below.

Check the health of these logs by using the ML prefix with Eseutil, followed by the log path

Eseutil /ml “M:\mx01\logs”

This will show the status of logs.

3. Proceed with soft recovery

If the logs are healthy, you can do soft recovery with the help of the EseUtil /r parameter.

Eseutil /r  “Path of the EDB file”

After the completion of the recovery process, check the state of the database again by using the Eseutil /mh command. If it shows a clean shutdown state, run the Mount-Database cmdlet to mount the database.

4. Perform hard recovery

 If the database still shows Dirty Shutdown state, hard recovery is the last resort. You should be aware of several other points before proceed with this method

  • Requires considerable storage space to process the database
  • Consumes significant time in completing the process
  • It permanently deletes any data that Eseutil detects as damaged

Owing to the risk of data loss, you should opt for it if you have no other choice for database recovery.

To perform this recovery process, use the Eseutil /p command. 

Eseutil /p “Path of the EDB file”

Accept the warning that you get when proceeding with this method. This will complete the hard recovery process.

 

5. Defrag the database

After completing the hard recovery, defrag the Exchange mailbox database to bring it back to the Clean Shutdown state by using the Eseutil /d command. You can then mount the database again.

Drawbacks of the Eseutil method

  • The administrator should have a credible experience of working in the Exchange Server environment
  • The expert must have penetrating technical knowledge of the involved operations
  • It is hard to predict the extent of data you will lose during this recovery method
  • The process consumes too much time and storage space


How to recover the Exchange database by using an Exchange recovery tool?

To avoid the hassles of manual Exchange recovery from a dirty shutdown state, admins use several Exchange recovery tools, such as Stellar Repair for Exchange. It can help you regain access to databases that have become corrupt due to a dirty shutdown. The tool provides multiple features:

  • Repair corrupt EDB files
  • Recovers deleted Exchange mailbox items
  • Fixes inconsistent Exchange databases
  • Recovers the database from Jet Engine Error
  • Exports recovered mailboxes to Office 365 or Live Exchange 
  • Converts EDB files to PST, RTF, HTML, PDF, and other formats
  • Shows an enhanced preview of mailbox items
  • Carries out eDiscovery & Granular Recovery

Using this tool is easy and self-explanatory. You simply need to select the corrupted EDB file, scan it, preview the recovered mailboxes before saving, and export them to the desired file format. You can have the software from its official webpage.

 

Conclusion

Multiple reasons can bring your Exchange mailbox database to the Dirty Shutdown state. Among these are damaged log files, outdated Exchange versions, a virus attack, sudden system shutdown, and so on. As a result, you may encounter any of several error messages, such as JET_errDatabaseDirtyShutdown (-550), MapiExceptionDatabaseError, JET_errRequiredLogFilesMissing (-543), etc.

To fix these errors and to bring the Exchange database back to a clean shutdown state, you can use the Eseutil recovery method. It involves doing soft repair by using Eseutil /r and later, hard repair by using Eseutil /p if the soft recovery does not work. 

However, hard recovery may permanently remove corrupted mailbox data. These manual methods consume much time and space, and need you to have in-depth technical knowledge. To avoid these limitations, using an Exchange recovery tool such as Stellar Repair for Exchange can be a viable option.