Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to defrag Exchange 2003?

Status
Not open for further replies.

dpu

IS-IT--Management
Jan 24, 2005
179
US
Can anyone tell me how to defrag Exchange 2003?
 

You shouldn't have to defrag very often. 2003 defrags itself (but does not shrink the DB size) nightly.

Unless you have deleted a lot of users/mail you should have that much free space in your DB to release.

You can check your event logs to how much space you will free up by doing an offline defrag:

 
I just did two today with this perfectly written article by MS:
---------------------

How to defragment with the Eseutil utility (Eseutil.exe)
View products that this article applies to.


This article was previously published under Q192185

On This Page

SUMMARY

MORE INFORMATION

Defragmenting an Exchange Server 5.5 database

Defragmenting an Exchange 2000 or Exchange 2003 database

Defragmentation/Compaction

SUMMARY

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. Eseutil examines the structure of the database tables and records (which can include reading, scanning, repairing, and defragmenting) the low level of the database (Ese.dll).

Eseutil is located in the Winnt\System32 folder in Exchange Server 5.5 and in the Exchsrvr/Bin folder in Exchange 2000 and in Exchange 2003. The utility can run on one database at a time from the command line.


MORE INFORMATION

The defragmentation option makes used storage contiguous, eliminates unused storage, and compacts the database, which 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.

----------

Defragmenting an Exchange Server 5.5 database

Note Defragmenting a database requires free disk space equal to 110 percent of the size of the database that you want to process. To determine the actual space required, follow these steps:

1.Make sure that the information store service is not running.

2.At a command prompt, run the following command:

eseutil /ms “database.edb”

.

3.Calculate the free space by multiplying the number of free pages by 4 KB.

4.Subtract the figure that you obtained in step 3 from the physical size of the database.

5.The figure that you obtained in step 4 represents the data in the database. Multiply this figure by 110 %. The resulting figure that you obtain is the space that you need to have available to defragment the database.

6.Divide the figure that you obtained in step 3 by 9 GB. The figure that you obtain is the approximate time that it will take to defragment the database.

Note 9 GB is the speed at which the Eseutil utility runs.

To defragment the Exchange Server 5.5 database, follow these steps:

1.Stop the service of the database you wish to defragment by using the Services tool 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.

Option Description ----------------------------------------------------------------------- /b <path> Makes a backup copy of the original uncompacted database at the specified location. /p Retains and preserves the original uncompacted database in its original location and stores the new compacted database in the default file Exchsrvr\Bin\Tempdfrg.edb. /t <file_name> Creates and renames the new compacted database in the specified path. /o Does not display the Microsoft Exchange Server banner.

-----

Defragmenting an Exchange 2000 or Exchange 2003 database

Note Defragmenting a database requires free disk space equal to 110 percent of the size of the database being processed.

1.
In Exchange System Manager, right-click the information store 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 runs the standard defragmentation utility on a mailbox store 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]

Defragmentation/Compaction

Performs off-line compaction of a database.

Syntax: eseutil /d <database_name> [options]

Parameters: <database_name> is the file name of the database that you want to compact.

You are not required to use any of the following options, but you can use one or more (separated by a space) to specify the operations that you want to perform on the database.

Option Description ---------------------------------------------------------------- /b<database> Make a backup copy under the specified name /t<database> Set the temporary database name (the default is Tempdfrg.edb) /s<file> Set the streaming file name (the default is NONE) /f<file> Set the temporary streaming file name (the default is Tempdfrg.stm) /p Preserve the temporary database (in other words, do not instate) /o Suppress logo /i Do not defragment streaming file

Note If instating is disabled (for example, if you use the /p option), the original database is preserved uncompacted, and the temporary database contains the defragmented version of the database.

For additional 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

For additional information about how to run Eseutil on a computer without Exchange Server, click the following article number to view the article in the Microsoft Knowledge Base:

244525 ( How to run Eseutil on a computer without Exchange Server

The Tempdfrg.edb file is created on the logical drive from which 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:

D:\>eseutil /d /ispriv

You 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.edb

--------------------------------------------------------------------------------

APPLIES TO

•Microsoft Exchange Server 2003 Standard Edition
•Microsoft Exchange Server 2003 Enterprise Edition
•Microsoft Exchange 2000 Server Standard Edition
•Microsoft Exchange Server 5.5 Standard Edition

Keywords:
kbhowto KB192185
 
Also you know that you can defrag the hard disk with either windows defragmenter or something like diskeeper while exchange is running.

Regards

Skr
 
Also you know that you can defrag the hard disk with either windows defragmenter or something like diskeeper while exchange is running.
Yikes! I would not suggest following the above advice. Great way to end up with a flatlined Exchange Database not to mention taking a serious performance hit.

Neither Windows Defrag or Diskeeper will defrag the Exchange Database since they view that as a single file. The built in Exchange tools are the only way to recooperate the space taken up by deleted accounts. (Either ESEUTIL or the normal maintenance Online Defrag)

The Exchange Databases are rather temramental when you start moving them around while the databases are online.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thanks for all the input. I migrated to 2003 from 5.5 & I used to defrag the database using the eseutil.exe tool. However, I read that 2003 defrags itself but not user if this is on by default or if I have to configure it. My database was at 4GB when I migrated and has doubled in size faster than I expected so I would like to recover any white space to shrink it.
 
The offline defrag is best for that.

Typically you will only encounter a need to defrag offline if you have created and deleted a bunch of users.

Check my FAQ referenced above. If you are taking the database offline to defrag, you should also be checking what logs are needed and also looking for database errors that can be repaired.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
To see if there is white space, check event id 1221. This tells you how much is there. 8GB is a tiny store - unless you have 3GB+ I'd say don't bother.

Online defrag of data pages has been done for more than just Exchange 2003. Most Exchange servers do not need offline defrag unless there is a problem.
 
Also you know that you can defrag the hard disk with either windows defragmenter or something like diskeeper while exchange is running.

Double yikes! A good way to test your Disaster Recovery!

Pat Richard, MCSE MCSA:Messaging CNA
Want to know how email works? Read for yourself -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top