ltstudiooo - Fotolia

Problem solve Get help with specific problems with your technologies, process and projects.

Exchange database maintenance requires oversight

Don't assume Exchange 2010 database maintenance is happening; administrators should check the event log and performance counter to ensure an Exchange database repair or recovery isn't required.

When the topic of Exchange 2010 maintenance arises, an administrator may first think of physical maintenance performed against a server, or perhaps the application of the latest service pack or update rollup. However, the concept of maintenance for Exchange 2010 applies across a broader set of topics where the administrator should build her familiarity.

The importance of Exchange database maintenance

One of the key changes seen in Exchange 2010 was the introduction of Background Database Maintenance (BDM), a collection of database maintenance tasks that are required to run regularly to ensure the ongoing successful operation of the server. BDM consists of five main database maintenance tasks:

  • Database defragmentation. This Exchange database maintenance process optimizes the free pages and also defragments sequential tables to improve efficiency. Since this is performed automatically when the databases are mounted, it is known as online defragmentation.
  • Database compaction. The database compaction process runs continuously in the background and performs compaction within the database only. This means that while pages within the database are compacted, the unused space is not returned to the file system.
  • Database checksumming. This process examines every database page for physical corruption. The default setting is that these checksums are run constantly in the background. For smaller databases, the checksums can be run as the last process in the scheduled mailbox database maintenance process.
  • Page zeroing. The process is a security feature that is designed to overwrite deleted pages so that it is more difficult to initiate an Exchange database recovery process to retrieve that data. Since Exchange 2010 Service Pack 1 was released, page zeroing is a continuous operation.
  • Page patching. This type of  Exchange database repair can mend a corrupted page within the database by retrieving a healthy copy of a corrupted page from a server hosting a copy of the replicated database.

Administrators will need to ensure these Exchange database maintenance tasks are functioning as expected by checking the event log and performance counter. The database maintenance performance counters can be found under the MSExchange Database object. For page zeroing performance counters, extended Extensible Storage Engine (ESE) counters will need to be enabled by following the guidance in this TechNet article.

High availability and maintenance

Even though a Database Availability Group (DAG) may have been deployed to provide high availability and site resilience for an Exchange 2010 deployment, there will come a time when it is necessary to perform either hardware or software maintenance on one of the servers that is part of this DAG. Having the DAG deployed is beneficial in a server maintenance scenario, since it permits the maintenance activity to be performed without affecting the service provided to the users.

While a DAG has its benefits, it adds complexity to the maintenance activity process. Before maintenance is performed on a server, an administrator must consider tasks, such as suspending the database copies on that server, as well as moving any active mailbox database copies on that server to other servers in the DAG. Moving the active databases in this manner is a process that Microsoft refers to as performing a server switchover. To make the server maintenance process easier for the administrator and to reduce risks associated with running commands manually, Microsoft provides the StartDagServerMaintenance.ps1 and StopDagServerMaintenance.ps1 Exchange Management Shell scripts. These scripts can be found in the \Program Files\Microsoft\Exchange Server\V14\Scripts folder on the drive where Exchange 2010 was installed.

While a DAG has its benefits, it adds complexity to the maintenance activity process.

The StartDagServerMaintenance.ps1 script is run before the maintenance activities are performed. As well as moving the active databases to another server, this script also performs key pre-maintenance tasks, such as preventing databases from being moved back to the server during the maintenance period and preventing the server from becoming the DAG's Primary Active Manager. The PAM is one of two Active Manager roles that can be run on a server in a DAG and is critical to DAG functionality. The server that owns the default cluster group runs the PAM role; to perform server maintenance on this server, it is necessary to move the PAM role to another server.

Once maintenance has been completed, the administrator can run the StopDagServerMaintenance.ps1 script which performs tasks such as resuming the database replication activities and ensuring that the databases on this server are not blocked from future activation. Both the StartDagServerMaintenance.ps1 and StopDagServerMaintenance.ps1 scripts are essential tools in the admin's toolkit when considering Exchange 2010 maintenance on the DAG server.

Database maintenance in Exchange 2010 doesn't always involve an entire server as there may come a time when an administrator needs to perform maintenance on a single disk housing a database. This is where the Suspend-MailboxDatabaseCopy command can be used to suspend replication for a database copy while that particular disk is worked on.

OAB maintenance awareness

Maintenance can also apply to topics not directly related to databases. The Offline Address Book (OAB) is a key component of an Exchange 2010 deployment to give users an offline copy of the address lists available in Outlook so this information can be accessed when the user is not connected to the network.

The OAB is generated and stored on the Exchange 2010 servers, and therefore administrators will need to review and act upon any OAB maintenance events that warrant further investigation. OAB maintenance events are logged in the application event log when the Microsoft Exchange Service Host service is started and will inform the administrator of key orphaned OAB recovery maintenance activities. These activities include notifications such as:

  • The orphaned OAB recovery scan has started and completed
  • Orphaned address books have been detected
  • Other significant events such as when an orphaned OAB has been moved to a different server

Next Steps

How to configure a DAG in Exchange 2010

How to keep virtualized Exchange 2010 mailbox server defragmented

Using the best practices utility to keep Exchange 2010 at peak performance

Dig Deeper on Exchange Server setup and troubleshooting