Friday, February 11, 2011

How to do a database Off-Line defrag in Exchange 2010

UPDATED 17/02/2011
Folks,
to be honest..the database's defrag is pretty the same as Exchange 5.5 version, but always is useful to remember the commands:

First of all , remember that:
Seeding is required under the following conditions:
  • When a new passive copy of a database is created. Seeding can be postponed for a new mailbox database copy, but eventually, each passive database copy must be seeded in order to function as a redundant database copy.
  • After a failover occurs in which data is lost as a result of the passive database copy having become diverged and unrecoverable.
  • When the system has detected a corrupted log file that cannot be replayed into the passive copy of the database.
  • After an offline defragmentation of any copy of the database occurs.
  • After the log generation sequence for the database has been reset back to 1.
So, we need to suspend the database copy first:

1-               Suspend-MailboxDatabaseCopy MST1DB1\MBXSERVER(passive) -Confirm:$false
2- Then all get the phisical database path
                  Get-MailboxDatabase "MST1DB1" | fl name,*path*
Name                    : MST1DB1
EdbFilePath             : E:\MST1DB1\MST1DB1.edb
LogFolderPath           : E:\MST1DB1logs
TemporaryDataFolderPath :
3- Dismount the database
                 Dismount-Database mst1db1 -confirm:$false
4- The defrag commnad (eseutil /D) , the /t switch redirects the temporary file to another disk (with enough free space ..of course)
                  eseutil /d E:\MST1DB1\MST1DB1.edb /t e:\def\temp.edb
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 14.01
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating DEFRAGMENTATION mode...
            Database: E:\MST1DB1\MST1DB1.edb
                  Defragmentation Status (% complete)
          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ...................................................

Moving 'e:\def\temp.edb' to 'E:\MST1DB1\MST1DB1.edb'... DONE!
Note:
  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.
Operation completed successfully in 9.656 seconds.

5- Finally mount the database
                         Mount-Database mst1db1

6- Update the databases copy
  
  Update-MailboxDatabaseCopy MST1DB1\MAILBOX SERVER(passive)  -DeleteExistingFiles
7- Check the database and copy status and check the database file's size in active server and in all passive servers
                  
                          Get-MailboxDatabaseCopyStatus -Server MAILBOX SERVER(passive)
 ESEUTIL is an Exchange database utility located in the \bin directory of Exchange server. A number of switches are possible with ESEUTIL:
  • ESEUTIL /D – Used for offline defragmentation of a Database
  • ESEUTIL /R – Used for recovery purposes of a Database
  • ESEUTIL /g – Performs an integrity check  of a Database
  • ESEUTIL /k – Performs a checksum test of a Database
  • ESEUTIL /p – Repairs a Database when it’s corrupt (and beyond recovery)
  • ESEUTIL /m – can dump header information of a Database and Log Files
  • ESEUTIL /y – can copy large files like Mailbox Database files efficiently
  • ESEUTIL /c – Is used to ‘hard recover’ a database during an online backup
Use defrag only for save disk space or for fix some database corruption.

-Dario

5 comments:

  1. bookmarked!!, I like your site!
    Also see my webpage :: exchange corrupt file

    ReplyDelete
  2. I read this paragraph completely concerning the resemblance of most
    up-to-date and preceding technologies, it's remarkable article.
    my page - edb exchange Recovery

    ReplyDelete
  3. I am extremely impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you modify it yourself? Either way keep
    up the excellent quality writing, it is rare to
    see a great blog like this one nowadays.
    my page :: reparer edb

    ReplyDelete
  4. Magnificent goods from you, man. I've understand your stuff prior to and you are just extremely fantastic. I actually like what you've bought right here, certainly like what you are saying and the way wherein you assert it. You are making it enjoyable and you continue to take care of to stay it smart. I cant wait to learn much more from you. That is really a tremendous website.
    Also see my site - edb exchange Recovery download

    ReplyDelete
  5. Buena aportación, justo lo que requería encontrar.
    JESN

    ReplyDelete

Note: Only a member of this blog may post a comment.