Exchange 2003 includes some utilities that can assist you in getting your database back up and running in case of corruption. At the very least, it will give you the ability to move your mailboxes to a new database.
Of course, the best option to repair a corrupted Exchange database would be from a valid backup. However, I have seen many instances where backups are not performed or they are bad. It is very important that you make it part of your daily or weekly activities to ensure backup is working correctly. If you currently do not use a backup, start now!
To repair your Exchange 2003 database, we must first check to see if Exchange was shutdown properly. You can use the ESEUTIL /mh on your database file.
C:\program files\exchsrvr\bin>eseutil /mh “c:\program files\exchsrvr\mdbdata\priv1.edb or pub1.edb”
If the database reports a Clean Shutdown run eseutil /g to perform integrity check on the database.
If Exchange shows a “Dirty Shutdown”, run the same command but with eseutil /p to check for corruption. Verify that you have sufficient disk space to do the repair. As a general rule, you should have the equivalent of 20% of the database size. If you don’t have that much free space on the drive where the database files are, you can use command line switches to redirect the temporary files created during repair to a different drive.
Eseutil is found in the \exchsrvr\bin directory created when you install Exchange on a server. You may want to add \exchsrvr\bin to your system path for convenience.
Eseutil repair command line:
eseutil /p c:\exchrvr\mdbdata\PRIV1.edb /s d:\exchsrvr\mdbdata\PRIV1.STM /Te:\TEMPREPAIR.EDB
This command line will repair PRIV1.EDB located on C: along with its matching .STM file located on D: and will put the temporary file on the E: drive.
Be sure that your streaming database file (.STM) is included in your command. These files contain important information (depending on your setup) that needs to be part of the repair process, especially if your clients connect to your Exchange server via POP3 and/or IMAP.
Once this has completed, the next step is Run Eseutil in /D (defragment) mode.
The repair process may leave index and space allocation problems in the database. Along with compacting the physical size of the file as much as possible, defragmentation also removes and rebuilds the indexes. Once eseutil /D has completed, you must start the Exchange Information Store Service.
The final step is to run the isinteg command:
c:\program files\exchsrvr\bin>isinteg –s servername –fix –test alltests.
You must have the Exchange Information Store service running and have the Exchange databases dismounted.
While running isinteg, you will encounter hundreds of warnings and possibly errors. This is by design. You can run this command as many times as it takes to get the errors to 0. If you cannot get the error count to 0, then it is recommended that you begin the process of moving mailboxes to a new data store. The database would not be reliable for production.
Once you get isinteg to display 0 errors, you can then mount the stores back in Exchange System manager and begin testing.
If you need more information on the specific commands / switches, check out this site.