How to Move Mailbox to Another Database in Exchange?

Exchange administrator can move user mailboxes in the Active Directory forest from one database to another between Exchange servers, or between mailbox databases on the same server through the Exchange Admin Center web interface or PowerShell CLI. Consider how to migrate mailboxes between databases using PowerShell (EMS — Exchange Management Shell) in Exchange 2016/2013/2010.

To move the user or resource mailbox from one database to another, you need to create a move request (if migration occurs within the same Active Directory forest, this is called a local move request; if you want to move a mailbox between AD forests — this is a remote move request). To move the user mailbox the New-MoveRequest cmdlet is used.

To create a local move request for a specific user’s mailbox, run the following command:

New-MoveRequest -Identity jsmith@theitbros.com -TargetDatabase lonDB2 -BadItemLimit 100

move mailbox to another database

The TargetDatabase parameter specifies the name of the mailbox database to which the mailbox should be moved. The BadItemLimit parameter indicates the number of corrupted items that can be skipped when moving a mailbox. If you specify BadItemLimit 0, it means that if there are any corrupted items in the mailbox, the move request will end with an error and the mailbox will remain in the source Exchange database.

By default, if you do not specify the BadItemLimit parameter in the New-MoveRequest command, its value is set to 0 and Microsoft strongly recommends not to change it. If you specify a BadItemLimit value greater than 50, Microsoft proposes to use an additional AcceptLargeDataLoss parameter.

Exchange moves boxes with a nominal priority by default. If you want to increase the priority of a specific mailbox migration, add the -Priority High parameter to the end of the New-MoveRequest command.

When the Mailbox Replication service (MRS) looks for new move requests in the queue to be processed, it first processes the move requests by priority and then by LastUpdatedTimeStamp.

If the mailbox size is quite large, it can move between mailboxes for quite a long time. To track the percentage of mailbox migration, you can use the Get-MoveRequestStatistics cmdlet. For example, to get the status of the jsmith@theitbros.com mailbox transfer, run the command:

Get-MoveRequestStatistics -Identity jsmith@theitbros.com

exchange move mailbox to another database

Pay attention to the PercentComplete column—it indicates the percentage of the task completion. The total mailbox size is listed in the TotalMailboxSize column.

To check if the user’s mailbox is now in the new mailbox database, run the command:

Get-Mailbox jsmith@theitbros.com | Format-List Database

You can get the statistics on all move requests as follows:

Get-MoveRequest | Get-MoveRequestStatistics

You can move all mailboxes in a specific database to another database. For the convenience of tracking the status of a move, you can specify the name of the batch move task (BatchName parameter):

Get-Mailbox -Database lonDB1 | New-MoveRequest -BatchName "lonDB1tolonDB2” -TargetDatabase lonDB2 -Priority High -BadItemLimit 50 –AcceptLargeDataLoss

The mailbox moves should then be queued on your Exchange server.

The status of the batch move task can be obtained as follows:

Get-MoveRequest -BatchName lonDB1tolonDB2 | Format-List DisplayName,Alias,Status,*database*

You can temporarily suspend the transfer of mailboxes with the command:

Get-MoveRequest | ? {$_.Batchname –like “*lonDB1tolonDB2”}|Set-MoveRequest –SuspendWhenReadytoCompleate

To continue the mailbox transfer run:

Get-MoveRequest | ? {$_.Batchname –like “*lonDB1tolonDB2”}|Resume-MoveRequest

new-moverequest

If you want to undo the move of a user’s mailbox that is already in the MoveRequet queue, use the Remove-MoveRequest cmdlet:

Remove-MoveRequest -Identity jsmith@theitbros.com

Also, do not forget to clear the completed Move Requests periodically with the command:

Get-MoveRequest | where {$_.status -eq “Completed”} | Remove-MoveRequest

If you will not do this, you will not be able to move the user mailbox, which is in the Move Request queue for a second time, even with the Completed status.

To migrate all mailboxes from a specific MBX server, use the command:

Get-Mailbox -Server exlonmbx1 | New-MoveRequest -TargetDatabase nyDB2

Note that migrating multiple user mailboxes at the same time can affect the disk performance of both the source server and the destination Exchange server. If you need to migrate all mailboxes from one mailbox database to another at a time in automatic mode (one mailbox at a time), you can use the following PowerShell script:

$usrmbxs = Get-Mailbox -Database lonDB1;

foreach ($mbx in $usrmbxs) {

New-MoveRequest -Identity $mbx -TargetDatabase lonDB2;

while ($(Get-MoveRequest -Identity $mbx.alias).status -ne ″completed″) {

Start-Sleep 60;
Get-MoverequestStatistics -Identity $mbx.alias

}
}

If the database has system mailboxes (Arbitration, Archive or Public Folder mailboxes), they need to be transferred separately:

Get-Mailbox -Database lonDB1 -Arbitration | New-MoveRequest -TargetDatabase lonDB2

Get-Mailbox -Database lonDB1 -Archive | New-MoveRequest -TargetDatabase lonDB2

Get-Mailbox -Database lonDB1 -PublicFolder | New-MoveRequest -TargetDatabase lonDB2

You can use the New-MoveRequest to migrate mailbox to the Exchange Online (the MSOnline PowerShell module should be installed on your computer):

$Creds= Get-Credential

Connect-ExchangeOnline
New-MoveRequest -Identity "jsmith@theitbros.com" -Remote -RemoteHostName "MRS_Proxy_Endpint" -TargetDeliveryDomain theitbros.mail.onmicrosoft.com -RemoteCredential $Creds -BadItemLimit 10 –SuspendWhenReadytoComplete

After the mailbox is synchronized with Exchange Online, you can manually complete the migration:

Get-MoveRequest | Where-Object Status -EQ AutoSuspended | Resume-Moverequest

You can batch move multiple mailboxes using a CSV file. To do this, use the New-MigrationBatch cmdlet (available in Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, and Exchange Online).

New-MigrationBatch -Local -AutoStart -AutoComplete -Name "lonDBMove01" -CSVData ([System.IO.File]::ReadAllBytes("C:\PS\lonDBMove01.csv")) -TargetDatabases lonDB2 -BadItemLimit 10

The CSV file lonDBMove01.csv must contain a list of user mailboxes to move (if you want to transfer only the archive mailbox, use the MailboxType parameter—ArchiveOnly, if the main mailbox—PrimaryOnly).

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
Cyril Kardashevsky

One comment

  1. hi,
    i have exchange 2016 with 4 mailbox databases
    do i need to transfer the monitoring mailboxes to which new 4 databases in exchange 2019

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.