Batch file to perform an offline defrag of the Exchange db to another drive

Published 19 August 09 07:43 AM | rodtrent

Just sticking this here as a placeholder for myself.  I’ve had the occasion to need to do offline defrags of the Exchange private store onto a different drive due to the drive where the private store having too little space.  Microsoft has some great documentation on using the eseutil, but their scenarios don’t include scripts for automating or scheduling after hours offline defrags.

As I have to perform additional offline defrags, I’ll post more scripts that have been tested to work so you can simply drop the script in a directory and schedule it to run with the operating system.

 

* Batch file for performing an offline defrag to another drive letter. The private store is installed on the D: drive and is being pushed to the Y: drive in the exchdefrag directory.

cd\
d:
cd\
cd\Program Files\Exchsrvr\bin\

eseutil /d /p "d:\program files\exchsrvr\mdbdata\priv1.edb" /t"Y:\exchdefrag\tempdfg.edb"

* Batch file for just doing a simple, in-place defrag (assuming you have enough disk space on the drive where the defrag is to take place):

cd\
d:
cd\
cd\Program Files\Exchsrvr\bin\


eseutil /d /p "d:\program files\exchsrvr\mdbdata\priv1.edb" 

ESEUTIL.exe command line switches:

DESCRIPTION:  Maintenance utilities for Microsoft(R) Exchange Server databases

MODES OF OPERATION:
      Defragmentation:  ESEUTIL /d <database name> [options]
             Recovery:  ESEUTIL /r <logfile base name> [options]
            Integrity:  ESEUTIL /g <database name> [options]
             Checksum:  ESEUTIL /k <file name> [options]
               Repair:  ESEUTIL /p <database name> [options]
            File Dump:  ESEUTIL /m[mode-modifier] <filename>
            Copy File:  ESEUTIL /y <source file> [options]
              Restore:  ESEUTIL /c[mode-modifier] <path name> [options]

<<<<<  Press a key for more help  >>>>>
D=Defragmentation, R=Recovery, G=inteGrity, K=checKsum,
P=rePair, M=file duMp, Y=copY file, C=restore

Filed under:

Comments

No Comments

This Blog

News

    Ni Hao! Wo shi Rod.



    The Bruce Campbell Fan Store



    Proud member of the myITforum Network



Community

Things I've done

myITforum.com

Things I do

Blog Roll

Syndication