
Online Database Maintenance
Each mailbox and public folder store requires periodic online maintenance to be run. By default, each database is set to run online maintenance between 1:00 AM and 5:00 AM. Online maintenance performs a variety of tasks necessary to keep the store in good health, including but are not limited to:
-
Task 1 Checking Active Directory to determine whether there are any deleted mailboxes.
-
Task 2 Permanently removing any messages or mailboxes that are beyond the configured retention period.
-
Task 3 Performing online defragmentation of database files.
These operations have specific performance costs, and you should understand these costs before you implement an online maintenance strategy.
Task 1 performs an Active Directory lookup for each user in the database. The more users you have in each database, the more LDAP directory searches are made. These searches are used to keep the mailbox store synchronized with any Active Directory changes (specifically, look for deleted mailboxes). The performance cost of this task is negligible on the Exchange server, but it can be significant on Active Directory servers depending on the number of users, the number of databases, and the online maintenance times of each database. In a corporate scenario, the online maintenance typically occurs at night, when very few users are logged on and the load on Active Directory servers is very low. The extra domain controller load created by online maintenance should not be a problem in this scenario.
If Exchange Server 2003 is installed in a global data center and serves customers from multiple time zones, the default online maintenance time may become an issue. The effect online maintenance has on Active Directory is proportional to the number of users in each of the server's databases. A check for a deleted mailbox is performed against each user in each database. Therefore, if you have 10,000 users spread over multiple databases on a server, 10,000 LDAP searches against Active Directory will occur at the default start time of 1:00 AM. If Active Directory servers are always (around the clock) under moderate load, stagger the online maintenance (set each database to start maintenance at a different time). Staggering the online maintenance is especially critical if you have hundreds of thousands of users spread across dozens of servers and hundreds of databases.
Tasks 2 and 3are very disk intensive and only affect the server where the maintenance is being run. During this part of online maintenance, the server may be perceived by users as sluggish if many databases are set to perform online maintenance at the same time. Again, in corporate scenarios, this maintenance would occur at night when the server can easily handle the extra load. In a global data center, it may make sense to stagger the database schedule (in respect to each other on a single server) to spread disk-intensive tasks over a greater period of time.
Online backup requires additional consideration. Backing up an Exchange Server 2003 database stops the maintenance of any database in that storage group (maintenance restarts if the backup finishes before the maintenance interval has passed). If you have two databases in a single storage group and one is running online maintenance, if a backup is started against either database, the online defragmentation on the database (which is running online maintenance) is stopped. It is critical that the backup time for any database in a storage group not conflict with the maintenance times of any database in the same storage group. If it does, backup stops the online defragmenting part of the online maintenance and the database may never finish defragmenting.
The correct online maintenance strategy can be devised by examining the user profile (such as times of low activity); knowing how many users, databases, and servers are in the site; and coordinating this information with the online backup strategy.
Here is an example of an online store maintenance schedule for a corporate Exchange 2003 mailbox server, which hosts users for a single time zone:
First Storage Group
Database One: Online maintenance runs between 21:00 and 01:00.
Database Two: Online maintenance runs between 21:30 and 01:30.
Database Three: Online maintenance runs between 22:00 and 02:00.
Online backup begins at 02:00 and backs up all databases in the first storage group when all databases have finished online maintenance.
Second Storage Group
Database Four: Online maintenance runs between 22:30 and 02:30.
Database Five: Online maintenance runs between 23:00 and 03:00.
Database Six: Online maintenance runs between 23:30 and 03:30.
Online backup begins at 03:30 and backs up all databases in the second storage group when all databases have finished online maintenance.
This configuration staggers the Active Directory LDAP queries generated by online maintenance, which are performed in the first minutes of the procedure, and makes sure that online backup does not interfere with online defragmentation.
The third task of defragmenting the database is made up of 18 separate subtasks. After a subtask has started, it must complete. Therefore, if subtask 12 is still running at the end of the online maintenance window, this task completes fully before the process exits. Therefore, online maintenance can run over the time window. Subtask 13 runs during the next online maintenance window. Depending on the run window and backup schedule, it may take more than one day for a full defragmentation to finish.