Database defragmentation is process of reducing the size of database and eliminating extra space by arranging non-contagious data into contagious form. To keep the size of Microsoft Exchange Server compact, online defragmentation of Exchange database is carried automatically during normal maintenance of MS Exchange database. However, as an administrator you understand that simply relying on online maintenance to manage disk space is not that great an idea. Therefore, Microsoft provides you with an additional defragmentation tool eseutil, which is a command line utility, using which you can defragment the Exchange database.
To defragment the database, you need to use eseutil/d command. When you use this command, the extra free space also gets deleted leading to a reduced size of the database. Although, using eseutil/d is not that difficult, but you need good technical knowledge before using it. Let us explore more about eseutil/d under following topics:
When you execute the eseutil command line tool with /d switch to defragment the database, then the defrag copy all the information of the original database to create a temporary database. While doing so, the tool discards the empty pages and then rebuilding the indexes of the database pages. After this, the original file is replaced with temporary file and is then renamed as original file.
While using eseutil/d command, make sure that 110% of the hard disk space is free to store the temporary database. If this condition is not met than the process of database defragmentation will not be completed. Another factor that may lead to abortion of defragmentation process is presence of bad records. If eseutil/d encounters any bad record during the defragmentation process, then it stops defragmenting the database immediately and displays an error message saying bad records are found in the database. Then you need to repair the database before defragmenting it again. You will need an Exchange Server Recovery tool for that.
The time needed for defragmentation of Exchange database depends on two factors:
1. the availability of free space in the database.
2. presence of the temporary database on same drive.
It is a common misconception among people that eseutil will take more time in defragmentation if the size of Exchange database is more. Eseutil does not consider the total size of the Exchange database but only considers the empty space in it. For example, eseutil/d will take same time in defragmenting a 50GB hard disk with 20 GB of free space and a 30 GB hard disk with 20 GB of free space.
Another factor that decides the speed of defragmentation is presence of temporary database on same (or different) drive and availability of free space on that drive. If the free available disk space is 110% of original disk space and temporary database is available on the same drive as original database, then the eseutil/d will take less time in defragmentation of the database. But in case the temporary database is stored in any other drive, time needed for defragmentation is more. Therefore, it is always advised to keep the temporary database on the same drive as original database.
As we have already discussed that the time needed for defragmentation of database depends on free space available in the database, therefore you must check the amount of free space available in the database before beginning the defragmentation process. Use the eseutil/d defrag tool only when sufficient free space is available on the database. During online defragmentation that is automatically done by Exchange Server, free space available in Exchange database is recorded in an event log file. You can calculate the free space available by viewing that event log. The event log contains following information regarding free space:
In the above log, computer name is the name of computer having Exchange Server and xxx is the amount of free space available in the database. Once you are confirmed that sufficient free space is available in the database, you can move ahead for eseutil defrag.
Eseutil /d command must be executed when following situations are true:
Eseutil /d command must not be executed when following situations are true :
Now that you have gathered all the information about eseutil/d command, let us see how to use eseutil/d for defragmentation of the database. When you are sure that 110% of free disk space is available on the disk, execute the following steps to defragment Exchange database on mailbox server:
Follow the steps given below to defragment the Exchange database on Hub Transport or Edge Transport Server::
In the last step mentioned above replace the term 'Drive' with the Drive letter where both Exchange database and Exchange Server is available. By following the steps mentioned above you can defragment the Exchange database on mailbox server and Edge Transport server. As already discussed above, the process of defragmentation may get aborted if any sort of inconsistency or bad records are found in the Exchange database. Then, you will need to first repair the database using Exchange Sever Recovery software before the defragmentation process.