Microsoft Exchange 2010 how to reduce the size of the database

This post is also available in: Polish

As is known in the Microsoft Exchange database size after removal of the mailboxes is not decreasing but remains the same.
Created the database “gap” so called White Space which tells us about the amount of available space, which can be used without the need to increase the size of the database file .edb.
Only after completing the White Space, a further increase in the size of mailboxes in the database, it will increase the file size .edb file.

In the case of Microsoft Exchange databases such solution is problematic, because in order to reduce file size .edb after removing mailboxes from the database we use the most with ESEUTIL, which have performed defrag the database.


This operation has its drawbacks, because it carried a risk of damage to the database, and during the defragmentation database had to be unmounted which resulted in lack of access to mailboxes.
Time defragmentation is quite long, on average 5-7GB is defragmented during 1h. Therefore, the average database defragmentation took about 24 hours.

To provide users with continuous access to mailboxes in reducing the size of the database, we can in Microsoft Exchange 2010 to create a new database, then move all the mailboxes with too many databases to a new database, then delete the old database.
Thanks to this new database size will correspond to total sizes of all mailboxes, and free space White Space will be eliminated.
This enables us to obtain significant reduction in file size .edb and thus accelerate the backup Exchange server.

 

The sequence of steps when moving mailboxes to another database in Microsoft Exchange 2010 DAG:

Make sure the database of the mailboxes if you want to reduce the space has a lot of white space. If free space is less than 10GB is assuming that the database is 100GB whole operation do not make sense.

White Space (AvailableNewMailboxSpace) check with PowerShell:

Get-MailboxDatabase BIGDatabse -Status | select Name, DatabaseSize, AvailableNewMailboxSpace

 

The next step is to create a new database which will used to move all mailboxes.

For this purpose, the server where you want to create a new database prepare a folder structure with the appropriate paths, and sufficient space for the new database.
The same thing we do for servers where they were copies of the database in the environment DAG.

Create a new database on the server where it should be kept active copy of the database.

The base can be created in the EMC (Exchange Management Console), expanding the tree on the left, Organization Configuration and then Mailbox, where select New Mailbox Database. Then type the name of the database, the server on which the database is deployed, we define a path for the database file .edb and for the logs.

Another way to create a new database is to use PowerShell commands.

Create a new database:

New-MailboxDatabase -Server 'EX2010_01' -Name 'NowaDatabase' -EdbFilePath 'P:MountPointsNewDatabaseEDBNowaDatabase.edb' -LogFolderPath 'L:MountPointsNewDatabaseLogs'

To ensure greater efficiency it is recommended that the database file .edb was on a different drive than the database log files.

Mounting Base:

mount-database -Identity 'NewDatabase'

 

After making sure that the new database is Mounted, proceed to create a copy of the database on another server belonging to the DAG.

This procedure also can be produced in the EMC (Exchange Management Console) and in the EMS (Exchange Management Shell).

Open a PowerShell console and type:

Add-MailboxDatabaseCopy -Identity 'NewDatabase' -MailboxServer 'EX2010_02' -ActivationPreference '2'

Activationpreference determines the order of mounting databases on servers, number 2 means that it is copy of an active database located on another server. For the active database value is 1 if the creation of a copy of the database we used the time, the active base was converted to the copy.

To set the created database in addition to its properties:

  • Limit the size of mailboxes for the base (Mailbox Database Quota Limit)
  • specifies the default public folder and address book OAB – Client Settings tab
  • Maintenance – the time window during which various operations are carried out based on


In addition, if we use our environment in other applications or servers that have access to mailboxes stored in the database (eg, a BlackBerry), we must give adequate access for:

get-mailboxdatabase –identity “NewDatabase” | add-adpermission –user <service account> -extendedrights receive-as,send-as

 

When you create a new database, and identifying the location of its copy, the next step is to move mailboxes from the old database to the new.

As usual, we can perform this operation using the EMC or EMS console.

If the console EMC (Exchange Management Console), go to Recipients section, where we set the filter to view only mailboxes located in the old database. Then select all the mailboxes, and on the right side, select New Local Move Request … then define the limit of “bad” items that may be omitted before the mailbox move operation is aborted.
Select the database created by us as the target and wait until the mailboxes to move.

Moving mailboxes by using the EMS console:

A much faster way to move mailboxes is to use PowerShell commands available in the Exchange Management Shell.

To move all mailboxes located in the old database to the new execute the command:

Get-Mailbox –Database ‘OldDatabase’ | New-MoveRequest –TargetDatabase ‘NewDatabase’

Thanks to this task will be launched moving all mailboxes to the new database.
To preview how much at the moment the move is carried out mailboxes, type the command:

Get-MoveRequest –MoveStatus InProgress

If you also want to determine the amount of bad items that may be omitted when you move the database then you should also use the BadItemLimit

This option allows you to skip from 1 to 50 messages, if the situation requires more missed messages, then we can also use:

-AcceptLargeDataLoss

Get-Mailbox –Database ‘OldDatabase’ | New-MoveRequest –TargetDatabase ‘NewDatabase’ -BadItemLimit 100 -AcceptLargeDataLoss

Of course, the whole process of moving mailboxes we can track in the graphics console EMC.

Note the default limits the Microsoft Exchange Server 2010 on the number of simultaneous operation of transferring the mailboxes to the same database. The default value is 2

If you are moving more mailboxes and want to increase this limit on the server then edit the file:

C:\Program Files\MicrosoftExchange Server\V14\Bin\MSExchangeMailboxReplication.exe.config

find the line:

MaxActiveMovesPerTargetMDB = "2"

and change this value to a higher mind that the greater number of simultaneous operations move puts additional strain on the server mailbox.

During moving mailboxes between databases in Exchange 2010, users will not lose access to theirs mailbox.

After making sure that all the mailboxes, were moved to new database, unmount old database and delete it.

 

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

5 Responses to Microsoft Exchange 2010 how to reduce the size of the database

  1. like this says:

    Not what I was looking for but great anyway! Nice one!

  2. Andreas says:

    We are currently trying this and something confuses us:
    Name DatabaseSize AvailableNewMailboxSpace
    —- ———— ————————
    ARCHIV 304.5 GB (326,963,888,128 bytes) 62.59 GB (67,205,300,224 bytes)
    TEMP_ARCHIV 361.8 GB (388,435,083,264 bytes) 74.97 MB (78,610,432 bytes)

    Shouldn’t the TEMP_ARCHIV be much smaller than the old ARCHIV-Database?

    Thanks for any input

    • Remigiusz Szatkowski says:

      you move all mailboxes from Archiv database to Temp_archive ?
      maybe during migration you also move archive mailboxes if you have it enabled ?

      • Andreas says:

        we are actually only moving the mailbox archives, not the mailboxes.
        This was part of the command we used:
        Get-Mailbox -Database $DBSourceName[$i] | New-MoveRequest -ArchiveTargetDatabase $DBTargetName[$i] -ArchiveOnly -BadItemLimit 1000 -AcceptLargeDataLoss
        One last MoveRequest is currently still running though, but i don’t think that the edb will be smaller after it finishes.

      • Andreas says:

        Just found the mistake. One of the Mailboxes had already a different archive database, which made up the huge difference.
        Thanks you for the great guide and if possible my comments can be deleted :)

Leave a 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>