The Value of ESEUTIL When Your Exchange 2010 Database is Dirty
- select the contributor at the end of the page -
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.
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.
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.
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.