Skip to content

Cannot delete mailbox database in Exchange Server

You cannot delete mailbox database in Exchange Server 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 will migrate the mailboxes too? Run the Get-MailboxDatabase cmdlet, including the -Status parameter, to check which mailbox databases are present and if they are mounted.

Read more: Check mailbox database mount status in Exchange Server »

[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" -ResultSize Unlimited

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 -ResultSize Unlimited | Where {$_.ArchiveDatabase -like "DB01"}

Move archive mailboxes to another database.

[PS] C:\>Get-Mailbox -ResultSize Unlimited | Where {$_.ArchiveDatabase -like "DB01"} | New-MoveRequest -ArchiveTargetDatabase "DB02"

Public folder mailbox

Find public folder mailboxes in the database.

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

Move public folder 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 -MoveStatus Completed -ResultSize Unlimited | 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 shows 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.

Remove mailbox database with ADSI Edit

You did all the above steps and still can’t remove the Exchange Server mailbox database. It means that the mailbox database is still in the AD configuration present.

Note: It’s not recommended to use ADSI Edit for Exchange tasks. There are situations where ADSI Edit is your last option.

To remove the Exchange Server mailbox database with ADSI Edit, follow the below steps:

  1. Start ADSI Edit on the Exchange Server or Domain Controller
  2. Click Connect to…
  3. Select Configuration
  4. Click OK
Cannot delete mailbox database Exchange Server ADSI Edit connect
  1. Expand CN=Configuration, DC=exoip, DC=local > CN=Services > CN=Microsoft Exchange > CN=EXOIP > CN=Administrative Groups > CN=Exchange Administrative Group > Databases.

Note: Select your internal domain instead of EXOIP.

  1. Right-click the mailbox database and click Delete
Cannot delete mailbox database Exchange Server ADSI Edit delete database
  1. Click twice on Yes to delete the container and everything in it
  2. Sign in to Exchange Admin Center and verify that the mailbox database has been deleted

Keep reading: Pause mailbox move request in Exchange Server »

Conclusion

You learned why you are getting an error and cannot delete a mailbox database in Exchange Server. 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 14 Comments

  1. to find what folder or files DB01 use are, run below:
    # note some of the folders may be also be used by other databases.
    Get-MailboxDatabase DB01 | Select-Object Name, *Path

  2. I’m encountering the same problem. In my case though I have mailboxes that are located on multiple databases:

    example

    jsmith is on DB01 but also on DB10
    I’ve moved the account from DB01 to DB10 using the eac but it still remains on DB01 and is now also on DB10. EAC reports that the account is on DB10. Is there anyway to remove these artifacts? I’m seeing this with HealthMailBox’s, In Place Archives and SystemMailbox’s. The system says they are located elsewhere but still exist in DB01.

    Jason

    1. I encountered this problem as well, however it turned out that the duplicate mailboxes were not what was preventing the DB from being removed.
      There was an account in the domain that had the database listed in the homeDB attribute, and clearing that allowed me to remove the database despite those duplicate mailboxes.

      I recommend following the answer posted by Oliver Weber.

  3. Went through this issue last week. Was trying to find remaining mailboxes with your process, but was unable to, always received provided error message.

    What helped me out was this:

    run: dsquery * forestroot -attr * -limit 0 >c:\temp\result.txt

    And search in result.txt for database name. Found out that the database was used in three accounts scattered all over our AD. Removed database name from accounts via ADSIEdit, then successfully deleted database.

    1. Thank you Oliver, this was the solution for me.
      I used “get-aduser -filter * -properties *” instead of dsquery and found there was still an account with the database listed in the homeDB attribute.
      After clearing that i was able to delete the database.

  4. 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? ????????

  5. 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.

  6. 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 *