Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007
Topic Last Modified: 2006-12-20

This topic explains how you can use the Exchange Server Database Utilities (Eseutil.exe) defragmentation command to defragment and compact an Exchange database offline. For more information about using the Eseutil /D command, see Eseutil /D Defragmentation Mode.

Before You Begin

Before you perform the following procedure on an Exchange server that has a Mailbox server role, a Hub Transport server role, or an Edge Transport server role installed, note the following:

  • Make sure you log on by using an account that is delegated membership in the local Administrators group on that computer.

  • Make sure you have free disk space equal to 110 percent of the end size of the database that you want to process.

    Note:
    You only need as much extra logical drive disk space as the final size of the files after defragmentation. To get an approximate estimate of the database (mailbox or public folder database) file size after defragmentation, look at application event ID 1221. This will tell you how much free space is in the database file. From the current database size, subtract the amount of free space specified in event ID 1221 to determine the approximate end size of the database after defragmentation. Although it is impossible to precisely predict how much disk space will be reclaimed, you should leave a recommended 110 percent of free disk drive space. Similar to how the mailbox or public folder database generates event 1221 to report logical free space after an online defragmentation, the Microsoft Exchange Server 2007 Edge Transport or Hub Transport server Queue database files also generate an event ID 7007 that reports logical free space after an online defragmentation. In addition, Queue databases on the Exchange 2007 Edge Transport or Hub Transport servers generate event ID 7006 to report logical free space before the online defragmentation. The source for these events is MSExchangeTransport.
  • Dismount a mailbox or public folder database before defragmenting. During an offline defragmentation, the dismounted mailbox or public folder database will be inaccessible to clients. Before performing an Eseutil defragmentation on a transport Queue database (Exchange 2007 Edge Transport or Hub Transport server database), stop the Microsoft Exchange Transport Service on the server. In addition, because the Queue database is offline during defragmentation, messages from the Queue database will not be delivered through the Hub Transport or Edge Transport server.

Procedure

To defragment an Exchange database on a mailbox server

  1. In the Exchange Management Console, right-click the database that you want to defragment, and then click Dismount Database.

  2. At the command prompt, point to the <Exchange install folder>\bin location.

    Note:
    <Exchange install folder> is the folder where you installed Exchange. The default location is \Program Files\Microsoft\Exchange Server.
  3. Type the Eseutil /D command, a database switch, and any options that you want to use. For example, the following command (all in one command) runs the standard defragmentation tool on a mailbox database:

    Copy Code
    C:\program files\microsoft\exchange server\bin Eseutil /d c:\program files\exchange server\mailbox\<storage_group_name>\<database_name>.edb
    
    Note:
    The default storage group name is First Storage Group, and the default database name is Mailbox Database, so the default path is C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group\Mailbox Database.edb.

    Use the following database switch to run Eseutil defragmentation on a specific database:

    Copy Code
    Eseutil /d <database_name> [options]
    

To defragment an Exchange database on a mailbox server using additional options

  • To defragment an Exchange database while keeping the temporary file intact, from the command prompt, run the following command:

    Copy Code
    eseutil /d <database_path_and_file_name> /p
    
    Note:
    This command can be valuable because it leaves the original database in place and does not write over it. This option increases the amount of available disk space required for defragmentation. This is because you will need space for two additional copies of the Exchange database.
  • To defragment the Exchange database but have the temporary file on another logical drive, from the command prompt, run the following command:

    Copy Code
    eseutil /d <database_path_and_file_name> /t <temp_database_path_and_file_name>
    
    Note:
    If the logical drive is accessible over a network connection, this can affect the amount of time that it will take defragment the database.

To defragment an Exchange database on a Hub Transport or Edge Transport server

  1. To dismount the Queue database, from the Services snap-in, stop the Microsoft Exchange Transport Service.

  2. At the command prompt, point to the <Exchange install folder>\bin location.

    Note:
    <Exchange install folder> is the folder where you installed Exchange. The default location is \Program Files\Microsoft\Exchange Server.
  3. Type the Eseutil /D command, a database switch, and any options that you want to use. For example, the following command (all in one command) runs the standard defragmentation tool on a transport Queue database:

    Copy Code
    Eseutil /d c:\program files\exchange server\TransportRoles\data\queue\mail.que
    
    Note:
    The default name of the Queue database is mail.que.

For More Information

You can see the complete command-line reference and syntax by typing Eseutil ./? at the command prompt and by selecting D for defragmentation.

For more information about Eseutil, see the following Eseutil topics: