Wednesday, December 18, 2013

Exchange Database Defragmentation Process. Complete Explanation

Exchange Database Defragmentation process. Complete Explanation

What is database defragmentation?
Database defragmentation is procedure for restoring the white space which is available in mailbox database.
Data is stored in pages in contiguous order in exchange mailbox database and on regular basis mailbox database size keep increasing because many reasons for example adding mailboxes to the mailbox database right. In one fine day you may observe that disk space is very less and you want to reduce the database size. There are two options are available here, you to vacate the mailboxes which are available in respective database, this activity doesn’t required any down time. If you’re having free disk space on other drive you can do this activity with less challenges.
Suppose you do not have alternate drive to move mailboxes  in that case you have option called ‘database defragmentation’ this is nothing but arranging data pages in contiguous order in respective database by doing this process occupied white space will be released and you will gain free space on drive.
Let us see know how to calculate white space, execute the below command, you can see the white space in availableNewMailboxSpace column



Before starting defragmentation process ensure that mailbox database need to dismount and ensure you have enough free space available on any drive.
For example database size is 19.26GB  and white space size is 6.103GB to do this defragmentation of this database 19.26-6.1=13.5+1=14.5 GB free space required approximately 15GB free space required
Why this much free space required or equivalent free space required?
During the defragmentation process, exchange will create a temporary defrag file to arrange data in contagiously and once the defragmentation process completes then exchange will delete the original database copy and replaces this tempdefrag file to the original database location. No need worry on this process its automatic exchange will do this.
In case you already started the defragmentation process without checking the free space in that case what will happen?
If you already started the process without checking the free space or you do not have sufficient space don’t panic let it run the process, if no enough free space available then defragmentation process cancels and it will not cause any problem to your database.

You have free space on other drive but not in C drive?
In general we will initiate the defragmentation process and temp file location automatically chosen to C drive (C:\program files\Microsoft\Exchange Server\V14\Bin or anywhere in C). in case you do not have free space on C drive and you enough free space on another drive then use /t switch to save temp file in another drive. I will show you in below.



I need to do defragmentation of the database but I have no enough free space on C drive but I have free space on E drive.
Execute the command as shown below such as eseutil/d “F:\dumpster Database\DB\dumpster database.edb” /t “E:\tempde\tempdefrag.edb”
This will crete temp edb database in E drive, once process completed it will automatically replaces in original edb location

Hope you learned the exchange defragmentation process please feel free to revert if you have questions