Exchange 2003 – Defragmenting Your Database with Eseutil

KB ID 0000814 

Problem

I don’t have many clients left that still have Exchange 2003, so this will probably be the last time I have to do this (famous last words).

Exchange databases NEVER get smaller, if you delete information out of them, it simply creates white space, that Exchange will reuse, (so they will steadily grow in size). Before you carry out this procedure, get your users to clear down their mailbox’s. Also delete/purge any unused mailboxes, this will make your defrag more efficient.

Solution

In my case the server the database was on was short on drive space. Remember you need 110% of the size of the database free space to carry out this procedure (so a 50GB database needs 110GB of free space to defragment). I did this with an external USB Drive.

Note: Moving large databases to USB media can take a while, at USB 2 Speed (48MBps (480Mbps)) took about 45 minutes to copy the database files to it.

1. You don’t need to to do this but, locate where the log files for this database are being stored, because in a minute we are going to take a copy (just in case). Right click the storage group the database is in > Properties > General > Transaction log location.

Exchange 2003 Log Location

2. Now for the database itself, right click the Mailbox Store (or public folder database if that’s the one you are going to defrag) > Properties > Database > Exchange databases.

Exchange 2003 Database Location

3. On my external drive I’ve created two folders, one holds the original untouched database files and the logs, the other (EDB_Files) holds a copy of the priv1.edb and priv1.stm files for the mailbox database that I’m going to defragment.

eseutil backup the database

4. Eseutil.exe lives in the Exchange program folder in the bin directory, change to that directory;

cd “c:Program FilesExchsrvrbin”

Now if we simply run eseutil on the database, it will create a temporary database on the C: drive, which I don’t want (remember we are tight for drive space). So I will specify where the temp database will be, and start the defragmentation.

eseutil /d {Path to the Database} /t {Path to the temp Database}

e.g.

eseutil /d H:EDB_Filespriv1.edb /t H:EDB_FilesTempDB.edb

Eseutil specify temp database location

How long will eseutil take? That’s a horrible question to answer, it depends on the CPU/memory of the server, and the size of the database itself. in this case it was a 70GB Database, on an HP G4 Series server, it took 11 hours and 6 minutes (approx).

5. When done it should say it has completed successfully.

Eseutil complete

6. You can now delete the original EDB and STM files from the Exchange Server.

Delete edb files

7. Then copy and paste your defragmented versions back into the original folder.

copy edb and stm files

8. You can now mount the mail store(s).

Mount Mail Database

9. Finally make sure you get a full backup of the Exchange database, (with some Exchange aware backup software).

Backup the Database

Related Articles, References, Credits, or External Links

ESEUTIL error – “Unable to find the callback library jcb.dll”

Author: Migrated

Share This Post On