How to remove or rename the default mailbase in Exchange Server?

When installing a new Exchange Server 2019/2016/2013/2010 with the mailbox role, a default database is automatically created. The base is created in the Exchange installation directory ( C:\Program Files\Microsoft\Exchange Server\V15\Mailbox ). The database name is also generated automatically (in my case it is "Mailbox Database 1200388344"). If you try to remove the default mailbase, you will encounter the error

This mailbox database contains one or more mailboxes

The fact is that this mail database stores a number of system mailboxes that are necessary for Exchange to work.

Full error description:

This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes. To get a list of all mailboxes in this database, run the command Get-Mailbox -Database <Database ID>. To get a list of all mailbox plans in this database, run the command Get-MailboxPlan. To get a list of archive mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -Archive. To get a list of all public folder mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -PublicFolder. To get a list of all arbitration mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -Arbitration. To disable a non-arbitration mailbox so that you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID>. To disable an archive mailbox so you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID> -Archive. To disable a public folder mailbox so that you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID> -PublicFolder. Arbitration mailboxes should be moved to another server; to do this, run the command New-MoveRequest <parameters>. If this is the last server in the organization, run the command Disable-Mailbox <Mailbox ID> -Arbitration -DisableLastArbitrationMailboxAllowed to disable the arbitration mailbox. Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan <MailboxPlan ID> -Database <Database ID>.

Screen:

How to rename and migrate the default mail database in Exchange Server?

First you need to determine the name of the database, the path to the EDB file and the logs. Launch the Exchange Management Shell (EMS) console or connect to your Exchange Server remotely using PowerShell:

Get-MailboxDatabase -server mbx3.winitpro.ru| fl Name, EdbFilePath, LogFolderPath

To change the database name, use the Set-MailboxDatabase cmdlet (it is not necessary to unmount the database):

Set-MailboxDatabase “Mailbox Database 1200388344” -Name MBX3-01

You can also rename the database from the Exchange Admin Center GUI.

Exchange places the database on the system drive (C:\) by default. Be sure to move the database files to another drive. Thanks to this, the growth of the edb file and the Exchange mail database log files will not take up all the free space on the Windows system drive.

To move a database, use the Move-DatabasePath PowerShell cmdlet. First you need to unmount the database:

Dismount-Database -Identity MBX3-01

Then start transferring the database files and log files:

Move-DatabasePath MBX3-01 -EdbFilePath E:\DB\MBX3-01.edb -LogFolderPath E:\DB\ MBX3-01
After the transfer is completed, you can mount the database:

Mount-Database -Identity MBX3-01

Delete the default database in Exchange Server.

To delete a database, you need to transfer all user boxes and service boxes to another database. The Get-Mailbox cmdlet without additional parameters does not display system and service mailboxes in the database. To search for arbitration mailboxes, run the following command:

Get-Mailbox -Arbitration -Database "Mailbox Database 1200388344"


If the mailbox list is empty, your configuration might have Exchange installed in a child domain. To search the entire Active Directory forest, you must enable the following setting:

Set-ADServerSettings -ViewEntireForest $true 

Now let's move these boxes to another database:

Get-Mailbox -Arbitration -Database "Mailbox Database 1200388344" | New-MoveRequest -TargetDatabase MBX3-02

In addition to arbitration boxes in the default mail database, there can also be user boxes, an administrator mailbox and Discovery Search Mailbox (used to search for messages in Exchange mailboxes. They also need to be moved:

Get-Mailbox -Database "Mailbox Database 1200388344" | New-MoveRequest -TargetDatabase MBX3-02


The mail database can also contain other types of mailboxes: Monitoring, Auditing (used to store audit events about user actions in mailboxes), archive mailboxes, public folder mailboxes. Consecutively check that your database does not contain these mailboxes:

$mbxdb="Mailbox Database 1200388344"
Get-Mailbox -Database $mbxdb -Auditlog
Get-MailBox -Database $mbxdb -Archive
Get-MailBox -Database $mbxdb -PublicFolder
Get-MailBox -Database $mbxdb -GroupMailbox
Get-MailBox -Database $mbxdb -Monitoring

If such boxes are found, they need to be moved using pipe:

| New-MoveRequest -TargetDatabase MBX3-02 (Monitoring box can be disabled | Disable-Mailbox -Confirm:$false)
Check that there are no user boxes left in the database:

Get-Mailbox -Database "Mailbox Database 1200388344"

The mail database can store the deleted mailboxes of disabled users. You can get a list of them like this:

Get-MailboxStatistics -Database "Mailbox Database 1200388344" | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate,MailboxGUID

After deleting the database, these boxes cannot be restored.

Check that the migration process was completed successfully (status Completed):

Get-MoveRequest | Get-MoveRequestStatistics


After the migration is complete, be sure to clear the migration queue:

Get-MoveRequest | Remove-MoveRequest

The default mail database can now be removed:

Remove-MailboxDatabase "Mailbox Database 1200388344"

After that, manually remove the directory with the database from the disk:

Remove-Item -LiteralPath "C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Mailbox Database 1200388344" -Force -Recurse

Отправить комментарий

Добавлять новые комментарии запрещено.*

Новые Старые