How To Recover Exchange Database Failure

Exchange database can be damaged because of improper shutdown, This can happens due to sudden power lost, server lacking of disk space, Operating system malfunction and so on ….

The tool to recover the database functionality called ESEUTIL and it is on the installation path of the exchange directory under BIN folder. This are some of the switches to run the command with :

ESEUTIL /D – defragment the database files
ESEUTIL /R – restore your database
ESEUTIL /G – check database integrity
ESEUTIL /K – verify checksums in the database
ESEUTIL /P – repair corrupt databases
ESEUTIL /M – display database files’ headers, logs or checkpoint files
ESEUTIL /Y – copy database files and log files in a more effective way
ESEUTIL /C – perform hard recovery of a database

When you have damaged database refusing to mount, First check its status with :

eseutil /mh "full path to the Database"

Look for the line called “state” which indicate the shutdown status. If it is in “Clean Shut down” the database is in good shape and you probably just out of space on the disk . If it is in “Dirty shut down” , You will need to repair the database and to bring it to “Clean shutdown” in order to mount it.

There are two forms of recovery:

  • Soft recovery   A transaction log replay process that occurs when a database is re-mounted after an unexpected stop, or when transaction logs are replayed into an offline file copy backup of a database.
  • Hard recovery   A transaction log replay process that occurs after restoring a database from an online backup.

To recover the database first check the main exchange log file :

ESEUTIL /ML E00.log

You can also check the log sequence to find problems there :

ESEUTIL /ML E00

The result should let you know the current log status, in case you will have Dirty shutdown scenario :

You will need to repair the database, first lets try soft recovery :

ESEUTIL /r <log_prefix> /l <path_to_the_folder_with_log_files> /d <path_to_the_folder_with_the_database>

The basic excution is just : ESEUTIL /r E00

You can try also to repair the bad Logs by Executing (I have found E00tmp.log in the logs folder, I have replaced it with bad Eoo.log and then the following or you can take the last log and re-name it to EXX):

ESEUTIL /r <log_prefix> /l <path_to_the_folder_with_log_files> /i

And Then

ESEUTIL /r <log_prefix> /l <path_to_the_folder_with_log_files> /a

Once it is finished , check the database status again :

eseutil /mh "full path to the Database"

If it is in clean shutdown , mount the database :

Mount-MailboxDatabase –identity <database_name>

If it is still in “Dirty shutdown” You will need to run Hard recovery

ESEUTL /P <path_to_the_database>


If the database is badly corrupted this will repair it but will cause some data lost , You should run isinteg tool as well to narrow the damage:

The path to this tool is as follows:

C:\Program Files\Microsoft\Exchange Server\Bin

In order to repair the database, you need to execute the following command:

Isinteg –s <server_name> -fix –test alltests

This command can be repeated as many times as it is necessary to get rid of all errors. Once the repair has been finished, you are ready to mount the database.

 

*. if you are in a hurry you can also move all the log files to tmp directory and restart the information store service, this will cause the exchange to reset the log files and sometime this will help to fast mount the database, depending on its damaged level.

*. Some time you need to move the CHK file and the E00 log file in order to run the soft recovery successfully .

*. Once the database is in “Clean shutdown”  you should run : eseutil /d “path to db” to defrag it, This will ensure the health state of the Database (can take some time).

more inforamtion on this tools :

https://technet.microsoft.com/en-us/library/aa996953(v=exchg.65).aspx

 


Good Luck

Leave a Reply

Your email address will not be published.