Microsoft Exchange Server Database Utility Guid

Microsoft Corporation

Published: December 12, 2006

Author: Exchange Server Documentation Team

Abstract

When a database is corrupted or damaged, data can be restored from backup or repaired using Eseutil. Eseutil is a command line utility that works with Extensible Storage Engine (ESE), database (.edb) files, streaming (.stm) files, and log (.log) files associated with an Information Store, in a given Storage Group.

Comments? Send feedback to .

Contents

Exchange Server Database Utility Guide

ISInteg

For More Information

Eseutil /D Defragmentation Mode

How Does Eseutil Defrag Work?

How Long Does it Take to Defragment a Database?

When to Run Eseutil /D?

When not to Run Eseutil /D?

For More Information

How to Run Eseutil /D (Defragmentation)

Before You Begin

Procedure

For More Information

Eseutil /P Repair Mode

Placing a Repaired Database Back Into Production

Eseutil /P Best Practice

Previous Exchange Versions

For More Information

How to Run Eseutil /P (Repair) in Different Scenarios

Before you begin

Procedure

Post-Repair Considerations

Command line reference

For More Information

Eseutil /C Restore Mode

For More Information

How to Run Eseutil /C (Restore) in Different Scenarios

Before You Begin

Procedure

Controlling Transaction Log File Replay.

Command line syntax

For More Information

Eseutil /R Recovery Mode

Hard Recovery

Soft Recovery

Version Differences

For More Information

How to Run Eseutil /R in Recovery Mode

Command Line Syntax for Running Eseutil /R

Command Line Syntax for More Complex Recovery Scenarios

Command line reference

For More Information

Eseutil /G Integrity Mode

Other Exchange Versions

For More Information

How to Run Eseutil /G in Integrity Mode

Procedure

Command line reference

For More Information

Eseutil /M File Dump Mode

For More Information

How to Run Eseutil /M in File Dump Mode

How to Run Eseutil /M

Command line reference

For More Information

Eseutil /K Checksum Mode

Previous Exchange Versions

For More Information

How to Run Eseutil /K in Checksum Mode

Before You Begin

Procedure

Command line syntax

For More Information

Eseutil /Y Copy File Mode

For More Information

How to Run Eseutil /Y in Copy File Mode

Procedure

Command Line Syntax

For More Information

Database Recovery Strategies

Understanding Database Structure

Understanding Database Recovery Strategies

For More Information

Reference for Common Eseutil Errors

Error Codes, Descriptions

For More Information

Copyright

1

Exchange Server Database Utility Guide

When a database is corrupt or damaged, data can be restored from backup or repaired using Eseutil. Eseutil is a command line utility that works with Extensible Storage Engine (ESE), database (.edb) files, streaming (.stm) files, and log (.log) files associated with an Information Store, in a given Storage Group. Eseutil is located in the C:\Program Files\Exchsrvr\Bin folder in Exchange Server 2000 and in Exchange Server 2003. The tool can be run on one database at a time from the command line and can be used to perform a range of database tasks from repair, offline defragmentation, and integrity checks in Exchange Server 5.5, Exchange Server 2000, and Exchange Server 2003. The most common Eseutil switches are listed in the table below.

Note:

Download Microsoft Exchange Server Database Utility Guide to print or read offline.

Eseutil Repair, mode can be used to repair a corrupt or damaged database while recovery and restore modes can be used to replay transaction log files into a database. The file header dump modes can be used to correlate database and transaction log files and to determine other information about them. The checksum mode can be used to verify the file integrity of a database. The copy file mode is useful for very rapid copying of large files. The defragmentation mode can be used to compact a database offline, reducing the size of the database files by removing empty space.

Topics in this guide give you an understanding of the Eseutil repair tool, tell you about scenarios where you can use the tool, discuss the different modes giving instructions on how to run Eseutil in those modes, and provide help with troubleshooting common Eseutil errors. For more information about common Eseutil errors, see Reference for Common Eseutil Errors.

Eseutil Mode / Switch / Description
Defragmentation / /D / Eseutil defragments the database files. This mode reduces the gross size on disk of the database (.edb) and streaming files (.stm) by discarding most empty pages and ad hoc indexes.
For more information, see these topics:
Eseutil /D Defragmentation Mode
How to Run Eseutil /D (Defragmentation)
Repair / /P / Eseutil repairs corrupt database pages in an offline database but discards any that can't be fixed. In repair mode, the Eseutil utility fixes individual tables but does not adjust the relationships between tables. ISInteg should be used to check logical relationships between tables.
For more information, see these topics:
Eseutil /P Repair Mode
How to Run Eseutil /P (Repair) in Different Scenarios
Restore / /C / Eseutil displays the Restore.env file and controls hard recovery after restoration from online backup.
For more information, see these topics:
Eseutil /C Restore Mode
How to Run Eseutil /C (Restore) in Different Scenarios
Recovery / /R / Eseutil replays transaction log files or rolls them forward to restore a database to internal consistency or to bring an older copy of a database up to date.
For more information, see these topics:
Eseutil /R Recovery Mode
How to Run Eseutil /R in Recovery Mode
Integrity / /G / Eseutil verifies the page level and Extensible Storage Engine (ESE) level logical integrity of the database but does not verify database integrity at the Information Store level.
For more information, see these topics:
Eseutil /G Integrity Mode
How to Run Eseutil /G in Integrity Mode
File Dump / /M / Eseutil displays headers of database files, transaction log files, and checkpoint files. The mode also displays database space allocation and metadata.
For more information, see these topics:
Eseutil /M File Dump Mode
How to Run Eseutil /M in File Dump Mode
Checksum / /K / Eseutil verifies checksums on all pages in the database and streaming files.
For more information, see these topics:
Eseutil /K Checksum Mode
How to Run Eseutil /K in Checksum Mode
Copy File / /Y / Eseutil performs a fast copy of very large files.
For more information, see these topics:
Eseutil /Y Copy File Mode
How to Run Eseutil /Y in Copy File Mode

ISInteg

The ISInteg utility is most often used after an Eseutil repair operation. It can also be used when an event or error warrants it. Several Microsoft Knowledge Base articles recommend the use of ISInteg for resolving specific issues.

ISInteg corrects database problems at the application level of the database. Eseutil corrects database problems at the ESE level. ISInteg understands the database as a collection of mailboxes and items in them, and can correlate and repair information and relationships between mailboxes, folders, items and attachments.

ISInteg was originally created as a utility for internal use by testers in the Exchange development group, and was released publicly because of its general usefulness. It can perform multiple independent and interrelated tests of the database, and can fix discrepancies found. ISInteg cannot comprehensively correct all possible problems in the database, but it is often very successful. Over time, ISInteg has been incrementally improved to make it more robust and useful.

For More Information

For more information about database recovery strategies, see Database Recovery Strategies.

For more information about common Eseutil errors, see Reference for Common Eseutil Errors.

For more information about the ISInteg utility, see the Microsoft Knowledge Base article 182081 "Description of the Isinteg utility" (

For more information about repairing Exchange databases and disaster recovery, see the Exchange Server 2003 Disaster Recovery Operations Guide (

For more information about understanding Extensible Storage Engine (ESE) file types, see Extensible Storage Engine Files (

Eseutil /D Defragmentation Mode

Eseutil's /D switch can be used to defragment and compact a database offline. The defragmentation option makes used storage contiguous, eliminates unused storage, and compacts the database thereby reducing the database's size. For instructions about how to use the Eseutil /D syntax, see How to Run Eseutil /D (Defragmentation).

Eseutil's /D switch can be used to defragment and compact a database. During typical operations, database files never shrink below their current size. As space in the database is freed by deletion of items, existing pages are reused where possible. Typically, a Microsoft® Exchange Server database will grow for several months after it is put in service, but eventually the database size stabilizes.

Under typical conditions, performing an offline defragmentation will not permanently recover significant disk space. The file will usually grow again to its previous un-defragmented size. Special circumstances, such as moving many mailboxes out of the database, may make it worthwhile to defragment the database offline. By default, during typical operation, the database is logically defragmented nightly. This does not reduce the size of the file on disk, but does make the database perform efficiently.

Note:

You can use the Eseutil utility to defragment the information store and directory in Microsoft Exchange Server 5.5 and to defragment the information store in Microsoft Exchange 2000 and newer versions.

How Does Eseutil Defrag Work?

When Eseutil defragments a database by eliminating unused storage and compacting the database, Eseutil actually creates a new database that contains all the information from the original database. When defragmentation is complete, the original database is deleted or saved to a user-specified location, and the new version is copied over the original. If the utility encounters a serious logical problem in the database, defragmentation stops. The database must then first be repaired with Eseutil /P before it can be defragmented.

When an offline defragmentation is performed, Exchange makes temporary copies of the database file (.edb file) and the streaming database file (.stm file). Tables from the .edb file are preserved and copied into the temporary database, but empty pages and indexes are discarded. Because this causes physical page numbers in the database to be changed, pages are not copied unaltered; the page links between them are all updated, and all pages left in the database undergo integrity checks. All pages in the .stm file that has information on them are preserved in the temporary .stm file, and references to the pages are updated in the .edb file.

How Long Does it Take to Defragment a Database?

The time length to complete defragmentation depends on how much of the database is empty, and not on the size of the database file. For example, defragmenting a 100 GB database that contains 10 GB of data takes about the same time as defragmenting an 11 GB database that contains 10 GB of data.

By default, after defragmentation is completed, the temporary database automatically becomes the new production database, and the original production database is deleted. The time that defragmentation takes can be significantly reduced if you have as much free space on the same logical drives as the size of the original database files. In this case, the temporary database can be put on the same logical drive, and the final copy will complete almost instantly.

We do not recommend that you use a network drive to hold the temporary database. When you use a network drive for the temporary database, defragmentation will take longer, and any transient or permanent network error will end the process. Because defragmentation cannot be resumed, you would have to start over from the beginning.

Note:

You only need as much extra logical drive disk space as the final size of the files after defragmentation. Although it is impossible to exactly predict how much disk space will be reclaimed, you should leave a recommended 110% of free disk drive space to be safe. For more information about how to determine the amount of disk space for defragmentation, see the Microsoft Knowledge Base article 195914, "Determining database free space with Exchange 5.5 Service Pack 1 and later versions of Exchange" (

When to Run Eseutil /D?

There are several situations where it is appropriate to run Eseutil /D to defragment an Exchange database. The following includes a list of those situations:

There is a significant amount of white space in the database that can be reclaimed and which will not be reused. An example can be when the number of mailboxes in the database has been significantly reduced.

An event is repeatedly logged in the Application log advising you to defragment the database offline. This may occur rarely when typical online defragmentation is no longer able to efficiently defragment the database.

When the 16 GB database size limit is reached on the Standard version of Exchange and white space must be reclaimed in order to mount the database. If you are running Exchange Server 2003, then Service Pack 2 (SP2) should be installed to raise the limit to 75 GB. For more information about increasing the database size limit, see Microsoft Knowledge Base article 828070, "Exchange Server 2003 mailbox store does not mount when the mailbox store database reaches the 16 GB limit" (

Note:

After defragmenting the database using Eseutil, we recommend that you perform a full backup of the database. A full backup is needed because the database defragmentation creates new database files which have new database signatures. Log file replay after the restore depends on database signatures to match the expected values recorded in transaction log files. Any database backups that are taken before the defragmentation will contain database files that have signatures different from the new defragmented database. If an older database is restored, the new transaction logs which are bound to the new defragmented database files will not replay.

When not to Run Eseutil /D?

There are situations where it is not appropriate to run Eseutil /D to defragment an Exchange database. The following includes a list of those situations:

Eseutil defrag should not be run as any kind of standard maintenance. Exchange runs an automatic online defragmentation nightly that handles the day-to-day maintenance of Exchange. There is no reason to periodically run an offline defragmentation unless special circumstances apply.

Eseutil defrag cannot not be run when the database is not in a consistent state.

Note:

As a rule, unless you expect more than 20 percent of available space to be recovered, defragmentation will likely not cause permanent shrinkage of the database files.

For More Information

For more information, see the following topics in the Exchange Server Database Utility Guide:

Eseutil /P Repair Mode

Eseutil /C Restore Mode

Eseutil /R Recovery Mode

Eseutil /G Integrity Mode

Eseutil /M File Dump Mode

Eseutil /K Checksum Mode

Eseutil /Y Copy File Mode

Database Recovery Strategies

Reference for Common Eseutil Errors

How to Run Eseutil /D (Defragmentation)

This section explains how the Eseutil command can be used to defragment, and or compact Exchange database files offline for all versions of Exchange. For more information about understanding Eseutil /D, see Eseutil /D Defragmentation Mode.

Before You Begin

Before you defragment a database using Eseutil, note the following:

1.Make sure you have free disk space equal to 110 percent of the end size of the database that you want to process (the end size being the current file size minus the size of the white space in the file).

2.Dismount the database before defragmenting as Eseutil performs an offline defragmentation. During the offline defragmentation the dismounted database will be inaccessible to clients.

Procedure

How to defragment an Exchange 2000 or Exchange 2003 database

1.In Exchange System Manager, right-click the database that you want to defragment, and then click Dismount Store.
2.At the command prompt, change to the Exchsrvr\Bin folder, and then type the Eseutil /d command, a database switch, and any options that you want to use. For example, the following command (all on one command line) runs the standard defragmentation utility on a mailbox database:
C:\program files\exchsrvr\bin> Eseutil /d c:\progra~1\exchsrvr\mdbdata\priv1.edb
Use the following database switch to run Eseutil defragmentation on a specific database:
Eseutil /d <database_name> [options]

How to defragment the Exchange Server 5.5 database

1.Stop the service that controls the database you wish to defragment by using the Services applet in Control Panel.
For the Exchange Directory database, stop the Microsoft Exchange Directory service.
For the Exchange Mailbox or Public Folder databases, stop the Microsoft Exchange Information Store service.
2.At the command prompt, change to the Winnt\System32 folder, and then type the Eseutil /d command, a database switch, and any options that you want to use.
For example, the following command runs the standard defragmentation utility on the directory and saves the copy in the user-defined file:
C:\winnt\system32> Eseutil /d /ds /tc:\dbback\tempdfrg.edb /p
Use one of the following database switches to run Eseutil on a specific database.
Option Description
------
/ds Directory
/ispriv Private information store
/ispub Public information store
Use one or more of the following options to specify the operations that you want to perform on the database.

Command line reference

This is the command line reference that can be seen by typing Eseutil ./? at the command prompt in the Exchsrvr\Bin folder, and the selecting D for defragmentation