skip to Main Content

Cannot delete mailbox database Exchange 2016

You cannot delete mailbox database in Exchange 2016 and an error is showing. Error: This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes. Why is that happening and what is the error telling?

In this article, you will learn why you cannot delete a mailbox database and the solution to the error.

Cannot delete mailbox database solution

The solution to the error is to make sure that there are no mailboxes in the database. If there are mailboxes in the database, you are not granted to delete the mailbox database in Exchange Server. You have to check all the mailboxes one by one in the mailbox database and move them to another database.

Cannot delete mailbox database Exchange 2016 error

Error: This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes, Audit 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 get a list of all Audit mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -AuditLog. 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. To disable a Audit mailbox so that you can delete the mailbox database, run the command Get-Mailbox -AuditLog | Disable-Mailbox. 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>.

Before starting to move mailboxes to another database

Important: Before you move the mailboxes, run the Set-ADServerSettings cmdlet including the -ViewEntireForest parameter. This will let you view the objects in the entire forest.

[PS] C:\>Set-ADServerSettings -ViewEntireForest $true

Check databases

Do you know to which database you are going to migrate the mailboxes too? Check mailbox database mount status in Exchange Server. Run the Get-MailboxDatabase cmdlet.

[PS] C:\>Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

Name Server    Mounted
---- ------    -------
DB01 EX01-2016    True
DB02 EX01-2016    True

Move mailboxes to another database

In our example, we are going to delete the mailbox database DB01. Before we can do that, we need to move the mailboxes. We are going to move all the mailboxes to the mailbox database DB02. The monitoring mailboxes associated with the mailbox database DB01 will be disabled.

Mailbox

Run Get-Mailbox to find all mailboxes in the database that you are going to delete.

[PS] C:\>Get-Mailbox -Database "DB01"

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Administrator             Administrator        ex01-2016        Unlimited
DiscoverySearchMailbox... DiscoverySearchMa... ex01-2016        50 GB (53,687,091,200 bytes)
Christopher Payne         Christopher.Payne    ex01-2016        Unlimited
Dylan Piper               Dylan.Piper          ex01-2016        Unlimited
Sam Blake                 Sam.Blake            ex01-2016        Unlimited

Move all mailboxes from one database to another with the New-MoveRequest cmdlet.

[PS] C:\>Get-Mailbox -Database "DB01" -ResultSize Unlimited | New-MoveRequest -TargetDatabase "DB02"

DisplayName              StatusDetail        TotalMailboxSize            TotalArchiveSize PercentComplete
-----------              ------------        ----------------            ---------------- ---------------
Administrator            WaitingForJobPickup 695.9 KB (712,591 bytes)                     0
Discovery Search Mailbox WaitingForJobPickup 0 B (0 bytes)                                0
Christopher Payne        WaitingForJobPickup 23.66 MB (24,812,530 bytes)                  0
Dylan Piper              WaitingForJobPickup 154.6 MB (162,135,858 bytes)                 0
Sam Blake                WaitingForJobPickup 339.6 KB (347,788 bytes)                     0

Mailbox Plan

Mailbox plan is not relevant for on-premises Exchange environments. It’s only available in cloud-based service.

A mailbox plan is a template that automatically configures mailbox properties in Exchange Online. Mailbox plans correspond to Office 365 license types. When you assign a license to a new user, the corresponding mailbox plan is used to configure the settings on the new mailbox that’s created. If you change the license that’s assigned to an existing user, the settings in the mailbox plan that’s associated with the new license are applied to the user’s existing mailbox.

Archive mailbox

Find archive mailboxes in the database.

[PS] C:\>Get-Mailbox -Database "DB01" -Archive

Move archive mailboxes to another database.

[PS] C:\>Get-Mailbox -Database "DB01" -Archive | New-MoveRequest -TargetDatabase "DB02"

Public folder mailbox

Find public folder mailboxes in the database.

[PS] C:\>Get-Mailbox -Database "DB01" -PublicFolder

Move public folders mailboxes to another database.

[PS] C:\>Get-Mailbox -Database "DB01" -PublicFolder | New-MoveRequest -TargetDatabase "DB02"

Arbitration mailbox

Find arbitration mailboxes in the database.

[PS] C:\>Get-Mailbox -Database "DB01" -Arbitration

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
SystemMailbox{1f05a927... SystemMailbox{1f0... ex01-2016        Unlimited
SystemMailbox{bb558c35... SystemMailbox{bb5... ex01-2016        Unlimited
SystemMailbox{e0dc1c29... SystemMailbox{e0d... ex01-2016        Unlimited
Migration.8f3e7716-201... Migration.8f3e771... ex01-2016        300 MB (314,572,800 bytes)
FederatedEmail.4c1f4d8... FederatedEmail.4c... ex01-2016        1 MB (1,048,576 bytes)
SystemMailbox{D0E409A0... SystemMailbox{D0E... ex01-2016        Unlimited
SystemMailbox{2CE34405... SystemMailbox{2CE... ex01-2016        Unlimited

Move arbitration mailbox to another database.

[PS] C:\>Get-Mailbox -Database "DB01" -Arbitration | New-MoveRequest -TargetDatabase "DB02"

DisplayName                           StatusDetail        TotalMailboxSize           TotalArchiveSize PercentComplete
-----------                           ------------        ----------------           ---------------- ---------------
Microsoft Exchange Approval Assistant WaitingForJobPickup 0 B (0 bytes)                               0
Microsoft Exchange                    WaitingForJobPickup 80.06 KB (81,984 bytes)                     0
Microsoft Exchange                    WaitingForJobPickup 1.519 MB (1,593,300 bytes)                  0
Microsoft Exchange Migration          WaitingForJobPickup 67.93 KB (69,565 bytes)                     0
Microsoft Exchange Federation Mailbox WaitingForJobPickup 0 B (0 bytes)                               0
E4E Encryption Store - Active         WaitingForJobPickup 0 B (0 bytes)                               0
Microsoft Exchange                    WaitingForJobPickup 0 B (0 bytes)                               0

Audit Log mailbox

Find audit log mailboxes in the database.

[PS] C:\>Get-Mailbox -Database "DB01" -AuditLog

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
SystemMailbox{8cc370d3... SystemMailbox{8cc... ex01-2016        50 GB (53,687,091,200 bytes)

Move audit log mailboxes to another database.

[PS] C:\>Get-Mailbox -Database "DB01" -AuditLog | New-MoveRequest -TargetDatabase "DB02"

DisplayName                                         StatusDetail        TotalMailboxSize TotalArchiveSize PercentComplete
-----------                                         ------------        ---------------- ---------------- ---------------
SystemMailbox{8cc370d3-822a-4ab8-a926-bb94bd0641a9} WaitingForJobPickup 0 B (0 bytes)                     0

Monitoring mailbox

Microsoft has not written in the error log to find and move monitoring mailboxes in the database. The best practice is to not move the monitoring mailboxes between mailbox databases. In my experience, it’s best to find the monitoring mailbox and disable them. If you don’t, you get a warning after deleting the mailbox database. Also, the health mailboxes will be in a corrupt state. Read the article, check Exchange health mailboxes.

Find monitoring mailboxes associated with the mailbox database.

[PS] C:\>Get-Mailbox -Database "DB01" -Monitoring | Format-Table Name, DisplayName, Database, Servername

Name                                          DisplayName                  Database ServerName
----                                          -----------                  -------- ----------
HealthMailbox8ddfa44ce87b470aa29ca09d63014c97 HealthMailbox-EX01-2016-005  DB01     ex01-2016
HealthMailbox217c956c6d8841c8849c3711a53c1548 HealthMailbox-EX01-2016-006  DB01     ex01-2016
HealthMailboxc50946e3d170463e96219bbccf5aa7e4 HealthMailbox-EX01-2016-007  DB01     ex01-2016
HealthMailbox5357efb1fdbe46f38be215864046302b HealthMailbox-EX01-2016-008  DB01     ex01-2016
HealthMailbox63585f5a8b7b4a47a7554c5081fb8cec HealthMailbox-EX01-2016-009  DB01     ex01-2016
HealthMailbox5b4ccf7b5d724fc692a14de58eb9249a HealthMailbox-EX01-2016-DB01 DB01     ex01-2016
HealthMailbox5aa9c931b1d84d51b8b7264a588f07d3 HealthMailbox-EX01-2016-001  DB01     ex01-2016
HealthMailboxf78993a630bb486aaf65a2c51568fb3a HealthMailbox-EX01-2016-002  DB01     ex01-2016
HealthMailboxd0bd623ed7274a9fa8dc23862052bdaf HealthMailbox-EX01-2016-003  DB01     ex01-2016
HealthMailboxeb024a7196dd4d3a9fd9ac13748cd762 HealthMailbox-EX01-2016-004  DB01     ex01-2016
HealthMailbox494bcf084a0e4d9ca46aab4f06ae290e HealthMailbox-EX01-2016-010  DB01     ex01-2016

Disable monitoring mailboxes.

[PS] C:\>Get-Mailbox -Database "DB01" -Monitoring | Disable-Mailbox -Confirm:$false

Verify mailboxes move

Verify that all the mailboxes are moved. After that, remove completed move requests. If you don’t, you will get the error this mailbox database is associated with one or more move requests. If you want to remove all move requests, run the third command.

[PS] C:\>Get-MoveRequestStatistics -MoveRequestQueue "DB02"

[PS] C:\>Get-MoveRequest -ResultSize Unlimited | Where-Object {$_.Status -Like "Completed"} | Remove-MoveRequest -Confirm:$false

[PS] C:\>Get-MoveRequest -ResultSize Unlimited | Remove-MoveRequest -Confirm:$false

Remove the mailbox database

Sign in to Exchange Admin Center. Click servers in the feature pane and click the databases tab. Select the database that you want to dismount in the list view. Click the More … icon in the toolbar and click Dismount.

Cannot delete mailbox database Exchange 2016 dismount database

After dismounting the database. Select the database in the list view and click the delete icon in the toolbar.

Cannot delete mailbox database Exchange 2016 delete mailbox database

A warning will show if you are sure to delete the database. Click Yes.

Another warning message is showing that the specified database has been removed. Note that we have to remove the database file from the system manually.

Start File Explorer on the Exchange Server and go to the location of the database. Delete the database and the logs folder.

Read more: Pause all mailbox move request in Exchange »

Conclusion

You learned why you are getting an error and cannot delete a mailbox database in Exchange 2016. Use the above commands to move all mailboxes to another database. After that, delete the mailbox database in Exchange Server. As of last, delete the mailbox database and log files manually in File Explorer.

Did you enjoy this article? You may also like Enable circular logging in Exchange Server. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 7 Comments

  1. How do you simply and authoritatively destroy *all* Exchange mailboxes? I’m not at all interested in moving them somewhere as this is the last and only Exchange server in the network and I’m TRYING to get rid of it (data has all been copied to PST files). So how doers one utterly destroy all traces of Exchange from their network when literally *all* of the (online) help on this subject assumes that nobody could or would ever need or want such a thing?

    Why exactly isn’t there a “Remove MS Exchange, Root and Stem, From your ENTIRE Network” option in the uninstall process? 🤔🤨

  2. Great Guide – one thing missing though. You also need to clear down any mailbox export reports if any exist.

    Get-MailboxExportRequest | Remove-MailboxExportRequest

    1. I tried to reproduce the issue, but I can’t confirm.

      What I did:
      – Export a mailbox that’s located on DB01 to PST file
      – Run the cmdlet Get-MailboxExportRequest
      – The mailbox export status shows as completed
      – I did not clear the mailbox request
      – Follow the steps in this article
      – Delete mailbox database DB01
      – The mailbox database is deleted without any error
      – Run the cmdlet Get-MailboxExportRequest
      – The mailbox export request still shows as completed

      Your suggestion might work for other readers. Thank you for letting us know.

  3. I have done all checking and the database cannot be deleted even though there are no mailboxes, archives, arbitration, monitoring, etc. it says there are multiple copies, but there is only one server of two that has mailbox related files. I manually deleted the .edb file but the system still thinks there are multiple copies of the database and won’t allow me to delete it.

Leave a Reply

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