[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Exchange 2003 Offline Defrag of the databases

Posted on 2009-02-10
9
Medium Priority
?
1,415 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

0
Comment
Question by:Tacobell2000
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 9

Accepted Solution

by:
Housammuhanna earned 2000 total points
ID: 23607286
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
0
 
LVL 9

Expert Comment

by:Housammuhanna
ID: 23607307

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
0
 
LVL 65

Expert Comment

by:Mestha
ID: 23607740
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
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:Tacobell2000
ID: 23607992
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
0
 
LVL 65

Expert Comment

by:Mestha
ID: 23609806
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
0
 
LVL 9

Expert Comment

by:Housammuhanna
ID: 23611328
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
0
 
LVL 65

Expert Comment

by:Mestha
ID: 23611564
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
0
 

Author Closing Comment

by:Tacobell2000
ID: 31545370
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
0
 
LVL 1

Expert Comment

by:infinitybs
ID: 34410892
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.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question