Solved

How to compact the Exchange 2007 Databases

Posted on 2008-10-15
12
11,656 Views
Last Modified: 2011-05-25
There are a billion how-to's on the 'net.  I'd like a real world answer to this question.

Very simply stated, how does one go about compacting the Exchange 2007 Databases on a Windows Server 2003 R2 Standard x64 box?  What services, if any, do I need to stop, is this a command line function, and if so, what are the exact switches, etc?

Thanks!
0
Comment
Question by:RLLSTech
12 Comments
 

Expert Comment

by:dano992
ID: 22722971
you can do a offline defrag using the ESEUTIL
that will reclaim all free space available
0
 
LVL 33

Expert Comment

by:Exchange_Geek
ID: 22724648

Very simply stated, how does one go about compacting the Exchange 2007 Databases on a Windows Server 2003 R2 Standard x64 box?

Well, if you are asking for what sort of real world solution is about (which includes MNC like WalMart - Microsoft - Netware - Shell - HP) uses - no one ever touches those switches EVER. For a simple reason Eseutil means that database has to go offline (that's a crime in today's world - ask your boss if you dont believe me). So now, what do we do ?

***We create a new mailbox store on the same server.
***Move mailboxes from source store to target store (in small batches over weekends)
***Once all mailboxes have been moved - this means that the corruption is also removed from your store including white spaces (since move mailbox would never carry empty spaces).
***Verify if the target store is working fine.
***Mount blank store (for source store)
***Move mailboxes back to this store (using the above steps)
***Now, what you have is a database that is corruption and white spaces free.
***Once, done DELETE the old store (which was earlier target store).

This requires ZERO amount of downtime - that is why it is preferred globally.

Is that clear ???

0
 
LVL 1

Author Comment

by:RLLSTech
ID: 22724764
Crystal clear.  That option was actually considered, but we're only a 47 user law firm, going offline at night is an option for us.  And this needs to be accomplished over the course of one evening.

So now that we know I can go offline.  What's the procedure?
0
 
LVL 33

Accepted Solution

by:
Exchange_Geek earned 500 total points
ID: 22724917
LOL well your the guy to decide it.

Keep it simple.

Check the last recorded event id 1221 - this would inform you the free space you would get after going through the following process.

Stop SMTP Service and Routing Engine Services.
Dismount your stores gracefully (right click and dismount stores)
Check the database path (go to properties - database tab)
Calculate the database size (.EDB + .STM)
You would require 110% of the above size free to run the Eseutil command.
Say for example you have the Database on C:\Program Files\Exchsrvr\Mdbdata and you have free space on D drive. In that case run the command from that particular command.

On the command prompt it should look like this.

D:\"C:\Program Files\Exchsrvr\Bin\Eseutil.exe" /d "C:\Program Files\Exchsrvr\Mdbdata\priv1.edb"

This command will run with speed 4-5 Gb/hr.

Once done. Please rename the log files folder (go to property of storage group in ESM) and replace with an empty folder - THIS IS IMP

Once done. Total the .EDB and .STM files and check if the size has reduced.

Mount stores gracefully (right click mount)

Phew..!!!!!!!!!!! that was alot of typing
0
 
LVL 1

Author Comment

by:RLLSTech
ID: 22724998
Thank you.  I understand all but one part:

"Once done. Please rename the log files folder (go to property of storage group in ESM) and replace with an empty folder - THIS IS IMP"

So, before I restart any services or remount the stores, I rename the folder in which the tracking logs are stored?

If I'm looking in the right place, I see this, "E:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\MessageTracking"  Is that correct?

0
 
LVL 33

Expert Comment

by:Exchange_Geek
ID: 22725181
Didn't i mention storage group properties ?? Those are located above your stores.

I was referring to transaction logs and not message tracking logs buddy.

The reason why it is important to rename the log file folder since the database signature gets changed after your eseutil is run over it and hence it cannot be associated with old log files. Hence, it would require new set of log files.

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:RLLSTech
ID: 22725218
You probably did.  I apparently don't absorb everything I read.  Anyway, I rename the folders, create a new folder for the transaction logs, then point the storage group properties to the newly created folder, correct?

Sorry for so many questions.  I've done some of this stuff on test servers, but not enough that I know it from memory.  Since this will be done on a live server, I really, REALLY don't wanna hose anything. :)
0
 
LVL 33

Expert Comment

by:Exchange_Geek
ID: 22725240
You do not need to make any changes at storage group since you would be recreating that folder.
Say for example if you have the log files folder named at  C:\LOGS - so you would be renaming this folder to say LOGS1 - and now you would recreate a blank folder with the name LOGS.

So nothing change at configuration level of Exchange.
0
 
LVL 1

Author Comment

by:RLLSTech
ID: 22727050
Got it.  I'm going to do this now.  I'll report back with the results.
0
 

Expert Comment

by:CharAp
ID: 22729934
If you have the hard disk space but the problem is that the message store is too large then surely you could just increase the maximum size of the message store - <a href="http://technet.microsoft.com/en-us/library/bb232092.aspx">see Technet</a>. A 2 minute registry change and a service restart must be easier than some of the above suggestions...
0
 
LVL 33

Expert Comment

by:Exchange_Geek
ID: 22731460
@CharAP: the question is "How to compact the Exchange 2007 Databases" Not how to reduce or prevent from having a big store. If it had been the latter - you had given a good solution, also it would have been a better resolution to divide mailboxes across multiple stores simple.
0
 
LVL 1

Author Closing Comment

by:RLLSTech
ID: 31506373
Everything worked beautifully.  Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
In this video we show how to create an email address policy 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 Mail Flow…
This video discusses moving either the default database or any database to a new volume.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now