Download EDB Converter Free

Monday, 4 May 2015

// // Leave a Comment

How to defrag exchange 2010 database [Step By Step Guide with Screens]

Why do we need to defrag the exchange mailbox database? Here are some situations in which you have to perform defragmentation on your exchange mailbox database:
  1. No additional space left to create a new database to migrate the mailbox.
  2. Active alerts for the low disk space.
  3. In order to claim whitespace created by archiving process.

Your options to reclaim space (whitespace) created due to deletion of mails and other items from mailbox are to either:
  • Create a new mailbox database and move all the mailboxes to that database: A mailbox migration has fewer risks, can be less disruptive as a whole, but will generate a lot of transaction logging that needs to be kept under control so it may take longer (i.e. several nights/weekends to migrate) as opposed to just one outage for a defrag.
  • Perform an offline defrag (using eseutil /d command): An offline defrag involves an outage for all users on that database, but may be more convenient if there is not additional storage available to allocate to the Exchange server to hold the new database.

Defrag exchange 2010 database using eseutli /d (Step by Step Guide)

  • You can defragment a database only if it is dismounted which means no user can access the database (emails) until the defrag process is complete.
  • You need some available disk space (1.2 times free space) to perform the defrag. This is because a new file is written during the defragmentation process. 
  • Most important one the backup that you can use for recovery if something goes wrong during the defrag. 

Here the steps that you can follow to perform defragmentation exchange 2010 database:
Step 1: Check the size of mailbox (how big it is?) and how much whitespace is there. To check this you need to run the following command in Exchange Management Shell.
[PS] C:\>Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace –auto
This command will show Name, Size and Available New Mailbox Space (whitespace). The whitespace is created due to             archiving. If you want to reclaim this space go to step 2.
Step 2: Open the Exchange Management Shell and navigate to the folder containing the database file.
cd D:\Data\MB-HO-01
Step 3: Dismount the mailbox database.
Dismount-Database MB-HO-01
Step 4: Run ESEUtil to defrag the file.
[PS] D:\Data\MB-HO-01>eseutil /d MB-HO-01.edb /t\\testserver\defrag\temp.edb
  It is recommended that you immediately perform a full backup
  of this database. If you restore a backup made before the
  defragmentation, the database will be rolled back to the state
  it was in at the time of that backup.
Step 5: Mount the database again.
mount-Database MB-HO-01
Step 6: check that the file is smaller, and all the white space is gone.
Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto

Reasons why not to do offline defrag

Here are the top reasons why you should not perform offline defrag using Eseutil /d unless or until it is very necessary:
  1. Database Dismounted during the defrag process: During the defragmentation process as stated above you need to dismount the database first. Dismounting the database for a long time can cause problem (emails can’t be accessed). After the defragmentation process complete you need to remount the database and take a full backup immediately which is time consuming.
  2. Risk of Database Corruption: There is risk of database corruption during the defrag process.
  3. Complicated and time consuming: offline defrag not only complicates the process of backup and recovery but also a time consuming process. 

So what’s the alternative for offline defrag process?

So what to do in case of getting active alerts for low space on storage (database need to be cleared) otherwise database dismounting problem.
Read the following post for better solution to increase the size of database and other life saving strategies that you can perform in order to save you exchange database from being corruption. 


Post a Comment