Clean Up That Store And Shrink It Too!

During a database backup you got a dreaded -1018, or -1019 error - indicating that your Exchange store is corrupt. But Exchange keeps running...

Or, you had kept dozens of "old" user mailboxes sitting around and you finally decided to purge them. After that, you find your Exchange database is half empty.

What do you do in these situations?

In the "old days", you would take your Exchange store offline, take an offline backup, and then start up ESEUTIL. The first step is "garbage collection". This removes all the unused space from the Exchange database, and compresses all the indexes - giving you a smaller Exchange database. Then you remount the database and it's all good.

Note: Garbage collection only removes unused space that has been processed by "online maintenance". If you remove 10 GB of mailboxes, and don't allow online maintenance to complete first, when you run garbage collection, that space will not be returned - because as far as the database software is concerned, the space is still in-use. This is similar to the difference between soft-delete and hard-delete in individual mailboxes.

Next, you take an online backup. The act of doing a garbage collection invalidates your earlier backups and transaction logfiles.

If you started this process because of a -1018 or a -1019, and the backup completes successfully, you are golden! You've successfully returned your database to production quality with no data loss. If you again receive an error, you must execute a database repair, during which you will almost certainly lose data. I'm not going to cover that here; if you are not certain what to do, your best bet is to open a case with Microsoft CSS/PSS.

Now, depending on your database size, and the amount of whitespace in that database, you may have had your mailbox database offline for many hours - causing pain and heartache for your users, and potentially bounced e-mail.

Let's talk about a mechanism for avoiding this downtime.

Note: This process will only apply to Exchange 2000 Server and Exchange Server 2003 Enterprise Editions, or to Exchange Server 2007. In Exchange 2000/2003, Standard Edition only supports a single mailbox store. In Exchange Server 2007 Standard Edition that limitation was (finally!) increased to five mailbox stores.

First, you must verify that you have at least twice as much disk storage as the mailbox store in question. If you do not, then an easy way to get significant additional temporary storage is to attach a RAID-1 (mirrored) USB disk (a couple of options are from Lacie's BiggerDisk line and Netgear's StorageCenter line - both of which I have used before). Please don't use a non-RAID solution. Cheap disk tends to not be enterprise quality, and fails quickly. Only trust your mailbox data to a RAID-based disk solution.

Next, create a new storage group and a new mailbox store in the location where you have the extra disk space.

Next, use the move-mailbox wizard to move all of the mailboxes from the old mailbox database to the new mailbox database.

Next, dismount the old mailbox store.

Next, REMOVE THE OLD MAILBOX STORE FILES. Yep, you read that right. But ENSURE and VERIFY you are removing the correct files. If you want to make certain, rename them instead and remove them later.

Next, remount the "old" mailbox store. A new empty database will be created.

Next, use the move-mailbox wizard to move all of the mailboxes from the temporary mailbox database back to their original mailbox database.

Next, dismount and remove the temporary mailbox database and storage group.

Finally, take a full backup.

There is no system downtime. During the entire process your Exchange server can continue to send and receive e-mail. However, there is some impact. Those mailboxes that are currently in use when you try to move-mailbox will not move. Outlook cannot connect to a mailbox in the process of being moved. However, this is a minimal impact compared to hours of system downtime. And, you can do it all in the background.

Add this to your repertoire. Practice it. It's easy to do. I've told you how. :-)

Until next time...

As always, if there are items you would like me to talk about, please drop me a line and let me know!

Published Wednesday, April 30, 2008 6:39 PM by michael
Filed under:

Comments

# Jeremy In Motion » Blog Archive » Exchange Store Cleanup

Pingback from  Jeremy In Motion  » Blog Archive   » Exchange Store Cleanup

Saturday, May 03, 2008 4:22 AM by subject: exchange

# Weekend reading

How to customize OWA in Exchange Server 2007 Top 10 Microsoft Exchange Server 2003 registry hacks What