Sysadminsblog.com Anything for sysadmins!

25Nov/100

Database Maintenance in Exchange 2010 – Online Defragmentation, Monitoring, Whitespace

Online Defragmentation/Monitoring

With the coming of Exchange 2010 the database maintenance has been simplified a lot. No more worries about online maintenance windows overlapping with the database backups. The reason for this is that the online defragmentation has been moved out of the mailbox database maintenance process. The online defragmentation is now running in the background all the time.

This option is enabled by default and no further settings are required. You can monitor the database defragmentation with the performance monitor by adding a couple of performance counters.

  • MSExchange Database ==> Instances \ Defragmentation tasks        Shows the background database defragmentation tasks currently executing.
  • MSExchange Database ==> Defragmentation Tasks completed/Sec    Shows the number of background database defragmentation tasks completing execution per second.
  • MSExchange Database ==> Defragmentation Tasks Discarded        Shows the background database defragmentation tasks that couldn’t be registered.
  • MSExchange Database ==> Defragmentation Tasks Pending        Shows the background database defragmentation tasks currently pending.
  • MSExchange Database ==> Instances \ Defragmentation        Tasks Scheduled/Sec Shows the background database defragmentation tasks scheduled for execution per second.

The performance counters are solely to check performance and are not required to be part of the daily maintenance of the database.

It’s also possible to enable extended Extensible Storage Engine (ESE) performance counters, but to enable these counters you’ll have to change a setting in the registry.

Whitespace

If you want to track the whitespace in your Exchange 2010 database you can use the following EMC command:

Get-MailboxDatabase -Status | Select-Object Name,AvailableNewMailboxSpace

The returned amount is however only the space available in the ESE B+-tree structure.

Older versions of Exchange generate an event with ID 1221 to show the whitespace. Exchange 2010 generates a similar event only for the mail queue database with event ID 7007.

During my search for information about whitespace I came across an interesting script by Mike Pfeiffer that generates quite some useful data about the mailbox database.

 Function Get-DatabaseStatistics {
</p><p>    $Databases = Get-MailboxDatabase -Status
</p><p>    ForEach($Database in $Databases) {
</p><p>        $DBSize = $Database.DatabaseSize
</p><p>        $MBCount = (Get-Mailbox -Database $Database.Name).Count
</p><p>        $MBAvg = $DBSize.ToBytes() / $MBCount            
</p><p>        New-Object PSObject -Property @{
</p><p>            Server = $Database.Server.Name
</p><p>            DatabaseName = $Database.Name
</p><p>            LastFullBackup = $Database.LastFullBackup
</p><p>            MailboxCount = $MBCount
</p><p>            "DatabaseSize (GB)" = "{0:n2}" -f ($DBSize.ToBytes() / 1GB)
</p><p>            "AverageMailboxSize (MB)" = "{0:n2}" -f ($MBAvg / 1MB)
</p><p>            "WhiteSpace (MB)" = "{0:n2}" -f ($Database.AvailableNewMailboxSpace.ToBytes() / 1MB)
</p><p>        }
</p><p>    }
</p><p>}

After running this script in the EMC you can execute the script by running Get-DatabaseStatistics. The output should be similar to the image below.

Be Sociable, Share!

Posted by Mischa Oudhof

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.