Using ESEUTIL to Repair an Exchange Database in Dirty Shutdown State
Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
3,500+ tech & creative courses authored by experts - unlimited & online Get it now →
February 23, 2011

The Value of ESEUTIL When Your Exchange 2010 Database is Dirty

By Using ESEUTL

ESEUTIL isn’t a new command-line tool, it’s been around since version 5.5 of Exchange Server and was used to defragment, repair and verify the integrity of Exchange databases. Depending on your experience with Exchange (and hopefully it has always been good) you may never need to use ESEUTIL.

However, if you ever find yourself restoring an Exchange database from a backup, you may find that the mounting aspect of that database won’t go so well. Your database is dirty and needs a little ESEUTIL scrub down.

How to Tell if Your Exchange Database is Dirty

What we mean by dirty is that the database is in a dirty shutdown state and typically means a transaction log(s) is missing (most likely your current log, ie. E00 or E01 or whatever your transaction log prefix).

So, first off, how can you tell if your database is in a dirty shutdown state? After you recover the database (but before trying to mount it) you can open a command prompt at the location of the database on the Exchange Server and type in: eseutil /mh “database name” as shown in Figure 1 below.

This screenshot, taken from my brand new Exchange 2010 Backup and Recovery Training course shows a database that has been recovered named stgirosgolfcourse.edb. We are using the /mh switch to help us read the header information from the database.

Using ESEUTIL
Figure 1: eseutil /mh “database name”

When searching the results of the eseutil command we can see in Figure 2 that it was found to be in a Dirty Shutdown state. If you want to check the header of the log file you can use eseutil /mh but this time you would indicate the log, for example E00.log. You can even review the header of the checkpoint file in the same way.

Using ESEUTIL
Figure 2: Identifying a database in dirty shutdown state

How to Repair a Dirty Database with ESEUTIL

You want to repair your dirty database and bring it to a clean shutdown state, but you have to make sure the database is consistent with the logs. So, you start off with a soft recovery using the eseutil /r switch. If your logs and database are in different locations you can use the /l “insert location” and /d “insert location” parameters as well.

You can see in Figure 3 that we used the command eseutil /r e02 to perform the soft recovery and you can see that it completed successfully.

Using ESEUTIL
Figure 3: How to perform a soft recovery

You hope this works when restoring from a backup because once the database is in a clean state (which you can now confirm by typing in eseutil /mh again) you can mount the database or switch it with a recovery database and begin recovering mailboxes or individual email items.

If it doesn’t work? Well, you might be looking at a hard repair, which is SURE to lose data along the way and it isn’t predictable in terms of how much. To perform a hard repair you type eseutil /p and indicate the database.

Playing with ESEUTIL

Most folks hope never to have to use ESEUTIL, but when they do, they aren’t ready. But you can play with ESEUTIL safely by backing up Exchange with Windows Server Backup, restoring to a folder on your system and using ESEUTIL on that restored database. You don’t have to mount it (although if you do, you should mount it to a Recovery Database, which is not so dangerous and good practice for you).

Once you are done playing you can just dismount and delete the Recovery Database and your production data will remain safe. However, if you aren’t too comfortable just yet with Windows Server Backup, creating and working with Recovery Databases and so forth, you might do well to check out my new course first.

Master Exchange 2010 Backup and Recovery

Our new Exchange Server 2010 Backup and Recovery Training is a fast paced, hands-on course that will teach you everything you need to know to master Exchange 2010 backup and recovery.

You’ll learn how to utilize command line utilities like ESEUTIL, recover items and mailboxes from a corrupted Exchange environment and utilize different backup and recovery tools. The course will also teach you how to determine the right approach to backup and recovery for your organization that is cost effective and efficient and provide you with a set of backup and recovery best practices that you can follow.

If you’re an Exchange admin looking to advance your career and gain a critical skillset, then take a look at our new Exchange Server 2010 Backup and Recovery Training.

Ready to test your skills in Exchange 2010? See how they stack up with this assessment from Smarterer, the newest addition to the Pluralsight family. Start this Exchange 2010 test now.

About the Author

(Exchange MVP, Triple-MCSE, MCT, MCITP: Enterprise Messaging 2007/2010) is an author with over a dozen titles sold internationally. He has written hundreds of articles, speaks at a variety of technical conferences held by Microsoft, 1105 Media, WindowsITPro and others and is the Enterprise Windows columnist for 3+ years for InfoWorld. Most notably, J. P. B. is a member of the Train Signal family and is our very own Exchange instructor. Follow him on Twitter at @jpbruzzese.

Author's Website: http://exclusivelyexchange.com/


Discussion