How to defragment Exchange databases
This article was previously published under Q328804
This article has been archived. It is offered "as is" and will no longer be updated.
The disk defragmentation process rearranges the data that is stored on the computer's hard disks so that the files are more contiguous. Defragmentation helps increase data access and retrieval speed. When you defragment your hard disks, you can increase disk performance and help the servers in your organization run more smoothly and efficiently.
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 Server and in Microsoft Exchange Server 2003. The utility can run on one database at a time from the command line.
Defragmenting an Exchange 2000 or Exchange 2003 database
To defragment an Exchange 2000 or Exchange 2003 database, follow these steps:click here to expand or collapse the steps
- In Exchange System Manager, right-click the information store that you want to defragment, and then click Dismount Store.
- At a command prompt, type the following commands, and then press Enter after each command: cd Exchsrvr\Bineseutil /dInclude a database switch, and any options that you want to use.
C:\program files\exchsrvr\bin>eseutil /d c:\progra~1\exchsrvr\mdbdata\priv1.edbFor more information about database switches, see the "Offline defragmentation" section. Defragmenting an Exchange Server 5.5 database
Note To defragment a database, you must have free disk space that is at least 110 percent the size of the database that you want to process. To determine the free space that is required, follow these steps:click here to expand or collapse the steps
- Verify that the information store service is not running.
- At a command prompt, type the following command, and then press Enter: eseutil /ms"database.edb”
- Calculate the free space by multiplying the number of free pages by 4 KB.
- Subtract the figure that you obtained in step 3 from the physical size of the database.
- The figure that you obtained in step 4 represents the data in the database. Multiply this figure by 1.10 (110 %). The sum total is the space that you need to defragment the database.
- To determine the approximate time that is required to defragment the database, divide the figure that you obtained in step 3 by 9 GB (9,000,000,000) per hour.
Note 9 GB per hour is the speed at which the Eseutil utility runs.
Use one or more of the following options to specify the operations that you want to perform on the database.
|/ispriv||Private information store|
|/ispub||Public information store|
To defragment the Exchange Server 5.5 database, follow these steps:
|/b Path||Makes a backup copy of the original un-compacted database at the specified location|
|/p||Retains and preserves the original un-compacted database in its original location and stores the new compacted database in the default file Exchsrvr\Bin\Tempdfrg.edb.|
|/tFile_Name||Creates and renames the new compacted database in the specified path.|
|/o||Does not display the Microsoft Exchange Server banner|
Note To defragment a database, you must have free disk space that is at least 110 percent the size of the database that you want to process.
- Use the Services item in Control Panel to stop the service of the database that you want to defragment. The service will be one of the following:
- 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.
- At a command prompt, type the following commands, and press Enter after each command: CD \Winnt\System32eseutil /dInclude a database switch, and any options that you want to use with the eseutil command. 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
Because offline defragmentation rearranges the data in the Exchange databases, use the Backup utility immediately after defragmentation to create standard backups of the databases that secure the new data arrangement. Earlier incremental or differential backups are no longer useful because they refer to database pages that were rearranged by the defragmentation process. For more information, see 258243: How to back up and restore an Exchange computer by using the Windows Backup program.
The fragmentation of Exchange data occurs on a different level than regular disk fragmentation. The fragmentation of Exchange data occurs within the Exchange database itself. If you run regular disk defragmentation on an Exchange computer, you should do it during off-hours and preferably with Exchange databases stopped. Disk defragmentation is a very I/O intensive process. Therefore, the Exchange database engine could have problems accessing the hard disks in a timely manner.
Fragmentation of Exchange data
By default, Exchange databases run a defragmentation process daily. The defragmentation option makes used storage contiguous, eliminates unused storage, and compacts the database. This reduces the database's size. Eseutil copies database records to a new database. When defragmentation is complete, the original database is deleted or saved to a user-specified location, and the new version is renamed as the original. If the utility encounters a bad record, the utility stops and displays an error message. Online defragmentationExchange database online defragmentation occurs automatically as part of the database maintenance process. Online defragmentation detects and removes database objects that are no longer being used. The online defragmentation process provides more database space without changing the file size of the database. By default, Exchange is configured to run online defragmentation daily between 01:00 and 05:00.
Note To increase the efficiency of maintenance and backup processes, you may want to schedule your maintenance processes and backup operations to run at different times.
To schedule database defragmentation, use one of the following methods:
- To schedule database defragmentation for a specific database, use the Maintenance interval option on the Database tab of a mailbox store or of a public folder store object to configure the maintenance interval.
- To schedule database defragmentation for a collection of mailbox stores and of public folder stores, use the Maintenance interval option on the Database (Policy) tab of a mailbox store or of a public folder store policy to configure the maintenance interval.
Although online defragmentation provides some additional database space, you must defragment the Exchange database offline to reduce the physical size of the Exchange database. Use the Eseutil utility (Eseutil.exe) to perform offline defragmentation when your mailbox stores and public folder stores are offline.
Note Eseutil is located in the Winnt\System32 folder in Exchange Server 5.5 and in the Exchsrvr/Bin folder in Exchange 2000 and Exchange 2003.
Eseutil is an Exchange utility that you can use to defragment, to repair, and to examine the integrity of Exchange databases. For example, you might perform offline defragmentation if you recently moved many users from a server that is running Exchange. In that case, offline defragmentation reduces the size of the Exchange databases by rearranging the data on the server's Exchange databases and discarding any unused database pages.
By default, the Eseutil /d command defragments a database by creating a new database, copying the old database records to the new one, and discarding any unused database pages. This creates a newly organized compact database file.
Use the following database switch to run Eseutil defragmentation on a specific database:
eseutil /d Database_Name [options]where Database_Name is the file name of the database that you want to compact.
Another option is to run Eseutil together with the /d /p switches at the command line to create the new defragmented database in a separate location. fFr example, you could create the new defragmented database on a different hard disk. By using the /p switch, the offline defragmentation process preserves the original database un-compacted, and the temporary file that is created is the defragmented version of the database. This is known as turning off instating. Unlike the standard offline defragmentation process (Eseutil /d), if you run Eseutil with the /d /p option, the original database is not overwritten with the new defragmented database when the offline defragmentation process is completed.
The /d /p option can also significantly reduce the time that is required to defragment large databases because you do not copy the defragmented database from the temporary location and overwrite the original fragmented file. However, if you want to mount the defragmented database after you use this option, you must manually move the defragmented .edb and .stm files into the database path and rename them to the correct database file names.
For example, if Tempdfg.edb and Tempdfg.stm are the defragmented files that you created by running the /d /p option, you must rename Tempdfg.edb to Priv1.edb and rename Tempdfg.stm to Priv1.stm. You must do this if Priv1.edb and Priv1.stm are the databases that you originally ran Eseutil against. The following example command defragments a database that is named Mailbox Store.edb and its accompanying streaming file, turns off instating, and creates the defragmented databases on the D drive. Note that there is no space after /t.
eseutil /d /p "c:\program files\exchsrvr\mdbdata\mailbox store.edb" /t"d:\tempdfg.edb"Note If you do not use the /t option, the Tempdfgxxxx.edb file and the Tempdfgxxxx.stm file are created in the location that you run Eseutil from. In the previous file names, xxxx is a random number.
Additionally, you may want to use the following options when you use Eseutil to defragment the Exchange databases:
Note The Tempdfrg.edb file is created on the logical drive where the eseutil /d command is run unless you use the /t switch. For example, to create a Tempdfrg.edb on the root of drive D, run the following command:
|/b Database||Make a backup copy under the specified name|
|/tDatabase||Set the temporary database name (the default is Tempdfrg.edb)|
|/sFile||Set the streaming file name (the default is NONE)|
|/fFile||Set the temporary streaming file name (the default is Tempdfrg.stm)|
|/p||eserve the temporary database (in other words, do not instate)|
|/i||Do not defragment streaming file|
D:\>eseutil /d /isprivYou can also use the /t switch to set the name for the temp database and for a different location. For example, to create a Sample.edb on the root of drive D when you are running the eseutil command from drive C, run the following command:
C:\>eseutil /d /ispriv /td:\Sample.edbNote If instating is disabled, the original database is preserved un-compacted, and the temporary database contains the defragmented version of the database. For example, instating is disabled when you use the /p option.
For more information about how to use Eseutil /d to defragment a database and the streaming file associated with the database, click the following article number to view the article in the Microsoft Knowledge Base:
254132 Eseutil /d defragments the database and the streaming fileFor more information about Exchange Server versions 4.0 and 5.0, click the following article number to view the article in the Microsoft Knowledge Base:
163627 How to defrag an EDB file on a non-Exchange server
Article ID: 328804 - Last Review: 12/07/2015 12:32:13 - Revision: 11.0
Microsoft Exchange Server 2003 Enterprise Edition, Microsoft Exchange Server 2003 Standard Edition, Microsoft Exchange 2000 Server Standard Edition
- kbnosurvey kbarchive kbinfo KB328804