Exchange 2010 Database size growing problem

This post is also available in: Polish

 

When you have Microsoft Exchange 2010 environment you can have problem with Exchange database size growing.

This is common problem and mostly caused by Exchange 2010 mailbox dumpster.

But if you have problem with mailbox databases backup, then all items deleted by users and all deleted mailboxes will not be purged until backup will end successful.

If you check size of all mailboxes in Exchange 2010 mailbox database, the sum of mailboxes can be less than mailbox database size. Yes we know that mailbox database has AvailableNewMailboxSpace but you can check that sum of mailboxes size and size of mailbox database white space can be also less then size of .edb file.

You can find informations how to reduce Exchange database size by moving all mailboxes from database to new one, or to dismount database and use Eseutil to defragment mailbox database. You can also find all disconnected mailboxes in database and purge them.

We wrote about this in post:
Microsoft Exchange 2010 how to reduce the size of the database

You can find information on Microsoft Support Website An Exchange Server 2010 database store grows unexpectedly large that if you want to stop mailbox database unexpected growth you need to install Rollup 1 for Microsoft Exchange 2010 SP2.

Unexpected growth of Exchange 2010 mailbox database can be caused by using:

  • using jurnaling mailbox in Exchange 2010 environment
  • using a third-party email message archival system

This issue can occur if the Microsoft Exchange Information Store service does not remove the deleted messages from the database.

Unfortunatelly when you use third-party email message archival system like Symantec Enterprise Vault, all emails moved to archive are deleted from user mailbox but they still remain in dumpster.

When you install Rollup 1 for Exchange 2010 SP2 it will probably fix this problem but it will fix only problem with new data added to archive but not clean the dirty pages or whitespace from preexisisting databases. 

More information you can find on Symantec Support Website:
Archiving of an Exchange 2010 database does not generate the expected amount of re-usable whitespace

 

How to resolve Exchange 2010 database growth:

 

When you apply Rollup 1 for Exchange 2010 SP2 you need to check few mailbox databases properties to make sure that all retentions and Quotas are configured properly.

To check Exchange 2010 mailbox database items retention like Mailbox, Deleted items and EventHistoryRetention you need to run Exchange Mangement Shell (EMS) with command:

Get-MailboxDatabase DB01 | fl *retention*

You will receive informations about retention for specified mailbox database like below:

MailboxRetention            : 30.00:00:00
DeletedItemRetention        : 14.00:00:00
EventHistoryRetentionPeriod : 7.00:00:00

Make sure that all Retentions are set !

Next you need to check RecoverableItemsQuota for mailbox Database like below:

Get-MailboxDatabase DB01 | fl recoverable*

RecoverableItemsQuota        : 30 GB (32,212,254,720 bytes)
RecoverableItemsWarningQuota : 20 GB (21,474,836,480 bytes)

also make sure it’s set for correct value which is mach to your Exchange environment.

Remember that RecoverableItemsQuota and RecoverableItemsWarningQuota value is set for mailbox not for all mailboxes. It means that each mailbox in mailbox database DB01 can use 30GB of Dumpster !!!

 

Exchange 2010 database size, whitespace, DeletedItems size

Now you can check size of mailbox database, size of whitespace, and size of DeletedItems in database.

Below you can find script which will list all mailbox databases located on server MBX01.
As result of this script you will get list of all mailbox databases with name, database size, whitespace size, sum of DeletedItems in each database, number of mailboxes in each database, and number of disabled (disconnected) mailboxes.

Set-AdServerSettings -ViewEntireForest $True

Function New-Array {,$args}
$Report = new-array

$databases = Get-MailboxDatabase -server MBX01 -status | sort name 

foreach ($db in $databases){
 $name = $db.name 
 $Size = $("{0:N2}" -f ($db.DatabaseSize.ToBytes()/1GB))
 $whiteSpace = $("{0:N2}" -f ($db.AvailableNewMailboxSpace.ToBytes()/1GB))
 $DeletedSum = (Get-Mailboxstatistics -Database $db | %{$_.TotalDeletedItemSize.Value.ToBytes()} | Measure-Object -sum).sum
 $DeletedSum = $("{0:N2}" -f ($DeletedSum/1GB))
 $mbxs = Get-MailboxStatistics -Database $db | Where {$_.DisconnectDate -eq $null -and $_.ObjectClass -eq 'Mailbox'} | Measure-Object
 #number of disconnected mailboxes 
 $mbxs_disc = Get-MailboxStatistics -Database $db | Where {$_.DisconnectDate -ne $null -and $_.ObjectClass -eq 'Mailbox'} | Measure-Object

 $tmp = New-Object System.Object
 $tmp | Add-Member -type NoteProperty -name Name -value $name
 $tmp | Add-Member -type NoteProperty -name Size_GB -value $size
 $tmp | Add-Member -type NoteProperty -name WhiteSpace_GB -value $whitespace
 $tmp | Add-Member -type NoteProperty -name DeletedSum_GB -value $DeletedSum
 $tmp | Add-Member -type NoteProperty -name MBXs -value $mbxs.count
 $tmp | Add-Member -type NoteProperty -name MBXs_disc -value $mbxs_disc.count
 $Report += $tmp
}

$Report | ft -auto

if you run above powershell script you will get belowed report:

Name   Size_GB WhiteSpace_GB DeletedSum_GB MBXs MBXs_disc
----   ------- ------------- ------------- ---- ---------
MXDB01  86,13   1,56         1,77           72   0
MXDB02 124,39  10,23         8,54          172   4
MXDB03  99,88   8,94         7,01          173   1
MXDB04 116,26  13,96         7,58          177   5
MXDB05 117,13   8,94         8,31          172   2
MXDB06 125,76  11,37         9,75          174  11

 

Now you can find mailbox database which have too big DeletedItems size (DeletedSum) and you can run command to clean Dumpster for mailboxes located in mailbox database.

If you want to list all mailboxes in MXDB01 where DeletedItems size in mailbox is greater than 100MB then you need to run below command:

Get-Mailboxstatistics -Database "MXDB01" | select displayname, @{expression = {$_.TotalDeletedItemSize.Value.ToMB()}; label="TotalDeletedItemSize"} | where {$_.TotalDeletedItemSize -gt 100}

 

You will get list of mailboxes and size of DeletedItems.

If you want to find all mailboxes on server MBX01 with DeletedItems size greater than 200MB you can run below script:

Set-AdServerSettings -ViewEntireForest $True
$Dumpster_Limit_MB = 200

$mbx_dumpster = Get-Mailboxstatistics -server MBX01 | select displayname, @{expression = {$_.TotalDeletedItemSize.Value.ToMB()}; label="TotalDeletedItemSize"}, Database | where {$_.TotalDeletedItemSize -gt $Dumpster_Limit_MB}
Write-Host "Found mailboxes: " $mbx_dumpster.count
$mbx_dumpster | sort TotalDeletedItemSize -Desc | ft -Auto

You will get list of all mailboxes with DeletedItems size more than 200MB with mailbox DisplayName and mailbox database name.

 

How to purge Exchange 2010 dumpster

Now when you know how to find mailboxes with too big dumpster size you can delete items in dumpster.

To delete all items in dumpster for specified mailbox use:

Search-Mailbox -Identity "John Smith" -SearchDumpsterOnly -DeleteContent -Force:$TRUE

 

to delete all items in dumpster but sent or receive before specified date use:
Date format may depend on country region settings.

Search-Mailbox -identity "John Smith" -searchQuery "Received:< $('2012-10-01') or Sent:< $('2012-10-01')" -SearchDumpsterOnly -DeleteContent

All emails in dumpster, sent or received before October 1st 2012 will be purged.

To check dumpster size for specified mailbox run:

Get-Mailboxstatistics "John Smith" | %{$_.TotalDeletedItemSize.Value.ToMB()} | Measure-Object -sum

 

If you want to check specified mailbox database and remove all deleted items received or sent before date, from mailboxes where DeletedItems size is more than 100MB use below command:

Set-AdServerSettings -ViewEntireForest $True

$mbxs = Get-Mailboxstatistics -Database MXDB01 | select displayname, @{expression = {$_.TotalDeletedItemSize.Value.ToMB()}; label="TotalDeletedItemSize"} | where {$_.TotalDeletedItemSize -gt 100}

foreach ($mbx in $mbxs){
 Search-Mailbox -Identity $mbx.DisplayName -searchQuery "Received:< $('2012-10-03') or Sent:< $('2012-10-03')" -SearchDumpsterOnly -DeleteContent -Force:$TRUE
}

 

After you remove unnecessary deleted items from dumpster you can again check Exchange 2010 mailbox database size, whitespace and deleteditems size.
You should see that whitespace size will increase.

When in database you will have a lot of whitespace then you should think about reducing database size explained here:

Microsoft Exchange 2010 how to reduce the size of the database

 

 

Print Friendly
Tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Exchange 2010 Database size growing problem

  1. Gaurav says:

    This is nice, thanks !

    • pawp says:

      AvailableNewMailboxSpace is not influenced by deleting items from dumpster. AvailableNewMailboxSpace shows space for new mailboxes only and it will increase when mailboxes are deleted and purged.

      • Remigiusz Szatkowski says:

        But when you purge dumpster from mailbox, after while you will have whitespace for this database increased.
        You can check this by running report of whitespace and deleted items in database, next purge deleted items, and after while again check whitespace for this database. It will be increased.
        Also when you disable mailbox and retention time for this mailbox will be end, then Exchange will purge whole mailbox and also whitespace will be increased in database

Leave a Reply to Gaurav Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>