Exchange has an Online Maintenance task that runs every night. In the Exchange Management Console (EMC), go to Organization Configuration > Mailbox > Database Management Tab > Right-Click our Database > Properties > Maintenace Tab. We can then see our Maintenance Schedule.
In Exchange 2010, this will appear as:
As you can see, in Exchange 2010, there is a new option that is enabled by default. This option is the “Enable background database maintenance (24 x 7 ESE scanning). This option is not Online Defragmentation, but is rather Database Checksumming. More on this later…
In Online Maintenance, there’s several tasks that run such as dumpster cleanup, purging mailboxes based on retention, etc… You can see a full list of these tasks here. When these eleven tasks successfully finish, an Online Defragmentation (OLD) process runs. Microsoft explains OLD as, “The intention for online defragmentation is to free up pages in the database by compacting records onto the fewest number of pages possible, thus reducing the amount of I/O necessary. The ESE database engine does this by taking the database metadata, which is the information in the database that describes tables in the database, and for each table, visiting each page in the table, and attempting to move records onto logically ordered pages.”
There is also a process called Online Maintenance Database Checksumming. Checksumming checks the integrity of the database by looking through every database page since there was no guarantee OLD would successfully look through every page to ensure there is no corruption. This process is entirely sequential and doesn’t cause a performance problem on the database. The issues with this method in Exchange 2007 RTM is that this process ran at the end of Online Maintenace and because of that, resiliency is effected as these processes temporary suspend continous replication. In Exchange 2007 SP1, Microsoft provided registry keys to allow you to run background checksumming. You can read more about these processes and the registry keys at the bottom of this article here.
In Exchange editions prior to Exchange 2010, we can monitor OLD by checking out the available 70x Event IDs in the Event Viewer’s Application Log. Similarly, you can verify the amount of whitespace that has been created in the database by viewing the 1221 Event ID. The list of Event IDs for Exchange versions prior to Exchange 2010 is as follows:
- 700 – Starting
- 701 – Completed
- 702 – Resuming
- 703 – Completed Resumed Pass
- 704 – Interrupted and Terminated
- 1221 – Whitespace Amount
This has all changed quite a bit in Exchange 2010. OLD2 is the new version of Online Defragmentation and no longer occurs at the end of the Online Maintenance Schedule. Instead, it runs 24 x 7 on a database. It is throttled so it does not negatively affect performance. You cannot modify OLD2 to run as OLD did in earlier versions of Exchange. OLD2 is not configurable. Because of this, the need to troll the above Event IDs is no more. Instead of trolling 70x Event IDs, Exchange 2010 will only notify you if something goes wrong with Online Maintenance. That way all the 70x error codes do not appear as spam. If you see a 70x in Exchange 2010, you know there is a problem. Keep in mind though, that this is all in regards to Mailbox Databases. Queue Databases still have 70x Event IDs.
If you need to check available whitespace, you can now do this via the Exchange Management Shell (EMS). Please keep in mind, this only pulls available whitespace from the root of the B-Tree database. If you want to find available whitespace for the entire database, you would have to dismount your databases and use eseutil. If your database is called Database1, the command would be:
Get-MailboxDatabase Database1 -Status | FL AvailableNewMailboxSpace
Note: The -Status switch is required when you need to contact the database directly for the following pieces of information:
- Available free space in the database root
As stated, OLD2 is throttled and doesn’t negatively affect performance. If you have an interest in monitoring performance of OLD2, you can do so by using the following perfmon counter set: MSExchange Database -> Defragmentation Tasks.
In Exchange 2010, there are two ways you can configure Online Database Scanning (checksumming). The first is the default option shown in the first image in this article. By default, it runs as a 24 x 7 process on the Active Database. You can uncheck this option which will then revert Online Database Scanning so that it runs after all online maintenance tasks are completed. Because most online maintenance tasks complete within an hour, this process works reasonably fine for smaller databases (under 500GB). Microsoft now supports up to 2TB databases. Anything larger than 500GB should definitely have the default set which is to run this process 24 x 7 to ensure it completes. Exchange 2010 was designed with the mindset that Online Database Scanning should complete at least once every three days. If it does not, Exchange 2010 will provide a warning event in the Event Logs.