We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Exchange 2003 Offline Defrag of the databases

Tacobell2000
Tacobell2000 asked
on
Medium Priority
1,426 Views
Last Modified: 2012-05-06
Hello,

I would like to know the best way to do an offline defrag of exchange server 2003 enterprise edition using a script
I came accross this script and would like some feedback on it. I would like to be able to automate
the defrag. Stopping the Information store, dismounting the databases, performing the offline defrag and creating a log file and once it is finished mounting the databases.Below is the code.
NET STOP MSExchangeIS
CD "C:\Program Files\Exchsrvr\bin"
ESEUTIL /D e:\Exchange Databases\"Default Mailbox Store.edb"
ESEUTIL /D e:\Exchange Databases\"Enhanced Mailbox Store.edb"
ESEUTIL /D e:\Exchange Databases\"Management Mailbox Store.edb"
 
"do not know how to create the lof file and mounting the database" Please help
 
Tacobell2000

Open in new window

Comment
Watch Question

Senior System Engineer
Commented:
HI
I have a small modification
NET STOP MSExchangeIS
echo "Operation started " > c:\start.txt
CD "C:\Program Files\Exchsrvr\bin"
ESEUTIL /D e:\Exchange Databases\"Default Mailbox Store.edb"
ESEUTIL /D e:\Exchange Databases\"Enhanced Mailbox Store.edb"
ESEUTIL /D e:\Exchange Databases\"Management Mailbox Store.edb"
net start msexchangeis

 
del c:\start.txt
No need to remount the database as long as starting the exchange IS will mount it
but I had the Echo "operation started" > c:\start.txt
so the system will write a file in the Drive C: and after the successfull operation for all steps the file will remove
so incase anything wronge go with the server like shutdown or anyother thing
if you find the file that mean that the operation did not complete
you can modify the log to be on each step

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Mehmet MuhannaSenior System Engineer

Commented:

You can make a log like this
before each database defrage have this
echo "Starting Defraging database named as Default...">>c:\MyLog.txt
ESEUTIL /D e:\Exchange Databases\"Default Mailbox Store.edb"
echo "Defraging the database default has completed" >> c:\Mylog.txt
 
and so on
Expert of the Quarter 2009
Expert of the Year 2009

Commented:
Why are you doing an offline defrag on Enterprise edition?
Waste of time. Just create another store, move the mailboxes and content to the new store, drop the original. Zero risk, zero downtime.

Remember offline defrag is not something that MUST be done as any part of regular maintenance and it is not risk free.

-M

Author

Commented:
mmmm "Waste of time. Just create another store, move the mailboxes and content to the new store, drop the original. Zero risk, zero downtime."

Is there a knowledge base article you can refer me to?

Tacobell2000
Expert of the Quarter 2009
Expert of the Year 2009

Commented:
KB article? Not that I am aware of.
It is a standard Exchange database procedure. Create a new store, move the mailboxes using Move Mailbox. Then drop the store in ESM. If you haven't moved everything it will not let you drop the store.
Once you have dropped the store, if it was the default store then restart the System Attendant service to get the system mailboxes to restart. Then you can delete the original database.

-M
Mehmet MuhannaSenior System Engineer

Commented:
Why to create a new one.
When moving the mailboxes . to another database, you are writing all the old database to the new one,
this also may make the new database fragment
I recommend that you run the offline defragment
I run it several time on several Org that have a Very lard mailboxes, and its working without problem
you can also use the command to make a temp database so incase anything goes wronge(but there should not) you can use the temp database
dont worry and go with Offline Defrag
Expert of the Quarter 2009
Expert of the Year 2009

Commented:
I have to strongly disagree with you.
Moving a large mailbox will not cause fragmentation of the database. It is the completely opposite. Don't confuse this with fragmentation of the database files themselves. That will get fragmented but it doesn't matter - there are no performance gains to be made from running a disk fragmentation tool on an Exchange database - that can actually cause damage to the database.

What do you think an offline defrag does? It creates a new database from the old one. It doesn't actually do anything with the original files. That is just the same thing that creating a new mailbox database and moving the mailboxes does, just without the risk.

The fact that it worked without a problem for you in the past does not mean that either a) it was the right thing to do, or b) it will continue to work without issues.

-M

Author

Commented:
ok...........the decision is to create the new store and move the mailboxes. I have tested Housammuhanna's script and it works.
Also many thanks to you Mestha.
Thanks.

Tacobell2000
Microsoft recommends to preform an offline defrag often. I think Mestha is confused. The offline defrag (eseutil) tools does perform something similar to creating a new database and moving the mailboxes but also preforms other functions as well. Besides, why do it manually when you can create a script to do it for you with the utility.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.