SUMMARY
This article provides steps for performing what is commonly called an MTACHECK.
This document describes when to perform the procedure, exact steps for
performing it, how to interpret the results, and what to do after performing
the procedure. This article is a supplement to Knowledge Base articles:
148284
XCON: When and How to Use the Mtacheck Utility
163326
XCON: How and Why to Run Mtacheck
When to Do an Mtacheck
MTACHECK checks the message transfer agent (MTA) database files in the MTADATA
directory for consistency and integrity. MTACHECK can also remove directory
replication messages, public folder replication messages, and link monitor
messages. MTACHECK removes corrupted or inconsistent messages from the queue.
Perform an MTACHECK under the following circumstances:
- When you receive an event in the application event log (Event Viewer)
which indicates that you should run MTACHECK to correct a problem.
- When you receive an event in the application event log, which suggests
that there may be corruption in the MTA database. Always check the
Microsoft Knowledge Base first for details on a particular Event ID.
- When the MTA queues are severely clogged with replication messages and
no mail is flowing.
NOTE: MTACHECK is not a maintenance utility. It is a repair utility and should
only be run to repair suspected or known corruption in the MTA database.
MTACHECK Utility
The following describes the MTACHECK command and optional switches.
mtacheck.exe /v /f mtacheck.log /rd /rp /rl
/v Log verbose details
/f Log to a file. The filename follows this switch after a space.
/rd Remove directory replication messages
/rp Remove public folder replication messages
/rl Remove link monitor messages
NOTE: "mtacheck.log" is just an example of a logfile name. Any filename can be
used.
NOTE: The /rd and /rp switches were first added to Mtacheck.exe with the
Exchange Server 4.0 Service Pack 4 (SP4). The /rl switch was first added to
Mtacheck.exe with the Exchange Server 5.0 Service Pack 1 (SP1).
MTACHECK Procedure
- Confirm that the registry contains the correct path to the MTADATA
directory. The key is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet
\Services\MSExchangeMTA\Parameters\MTA database path.
- Stop the Exchange Server MTA.
- IMPORTANT: Back up all \MTADATA\DB*.DAT files. DO NOT SKIP THIS
STEP!
- Confirm the backup by number of files and total size of the directory.
NOTE: DO NOT delete the DB*.DAT files from the Mtadata directory.
- From the \Exchsrvr\Bin directory, run MTACHECK.EXE /? to determine what
switches are available. If at all possible, help the customer obtain the
MTACHECK.EXE that comes with Exchange Server 4.0 SP4 or later.
- Run MTACHECK.EXE with the preferred optional switches. See the "When to
Use Optional Switches" section below.
Depending on computer speed, this generally takes one minute for every thousand messages. - If MTACHECK completes with any errors such as
Database repaired, some data may have been lost.
- 0 queue(s) required repair out of 6 detected (0%).
- 1 object(s) damaged out of 34 detected (2%).
delete all the files in the \Mtadata\Mtacheck.out directory and run the
command again. - When MTACHECK completes successfully, it will display:
Database clean, no errors detected.
- Restart the MTA.
NOTE: Do not be alarmed by the "some data may have been lost ..." message.
Objects and queues that were either damaged or corrupted were of two types:
those that we don't mind losing (replication messages, link monitor messages),
and those that could not have been salvaged anyway. Replication and link
monitor messages are naturally regenerated, and hence are expendable. Simply
repeat the MTACHECK command until you receive the message "Database clean,
no errors detected."
When to Use Optional Switches
Use the following guidelines for deciding when to use an optional switch:
- Reducing the size of the MTA database.
If you want to reduce the number of DB*.DAT files in the \MTADATA
directory, use the /rd, /rp, and /rl switches serially. In other
words, first run
MTACHECK.EXE /rd
and let it complete. This will eliminate any directory replication
messages currently in the MTA database. Then run
MTACHECK.EXE /rp
to eliminate public folder replication messages. Finally, run
MTACHECK.EXE /rl
to eliminate any link monitor messages. - Quick integrity check.
If you want to perform a quick integrity check of the MTA database to
see if any DB*.DAT files are corrupt, simply run MTACHECK.EXE with no
optional switches. If any corrupt files are found, they will be moved to
the \MTADATA\MTACHECK.OUT directory. - Gathering details on the MTA database.
If you want to get details on the MTA database, such as the number of
static queues, the ID of a particular queue, or the exact objects
currently stored in a particular queue, run
MTACHECK.EXE /v /f mtacheck.log
This will generate a text file named Mtacheck.log in the directory you
ran MTACHECK.EXE from (usually \Exchsrvr\Bin). This text file is an
invaluable resource when you are attempting to track a specific object
in the MTA.
What to Do Next
You can expect the MTA to take several minutes to rebuild queues after
doing an MTACHECK. After performing an MTACHECK, you should monitor the
MTA to ensure that the errors you encountered prior to the check have been
eliminated. An MTACHECK should be considered a solution only when it
permanently eliminates the problem it was attempting to fix. If the problem
recurs, you should follow other procedures to further troubleshoot.