Delete Exchange database

When you try to delete a mailbox database from Exchange, you might see an error like this:

Wall of text: a long error message with red text on a black background.

At first glance, that’s not very user-friendly! I’ve seen some people get stuck at this stage and ask for help. However, the error message does actually tell you everything you need to know.

The first thing to do is copy and paste the error message into a text editor (e.g. Notepad). It will then look like this:

This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, or arbitration mailboxes. To ge
t a list of all mailboxes in this database, run the command Get-Mailbox -Database . To get a list of all m
ailbox plans in this database, run the command Get-MailboxPlan. To get a list of archive mailboxes in this database, ru
n the command Get-Mailbox -Database -Archive. To get a list of all arbitration mailboxes in this database
, run the command Get-Mailbox -Database -Arbitration. To disable a non-arbitration mailbox so that you ca
n delete the mailbox database, run the command Disable-Mailbox . To disable an archive mailbox so you can d
elete the mailbox database, run the command Disable-Mailbox -Archive. Arbitration mailboxes should be move
d to another server; to do this, run the command New-MoveRequest . If this is the last server in the organi
zation, run the command Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed to disable the
arbitration mailbox. Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan -Database .

You’ll notice that line breaks are inserted after every 119 characters, regardless of whether that happens to be in the middle of a word. (The line length might depend on the size of your PowerShell window, but it will always be a fixed length.) So, the next task is to remove all the original line breaks, allowing your text editor to wrap the text:

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

Now add your own line breaks to make it more readable:

This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, or arbitration mailboxes.

To get a list of all mailboxes in this database, run the command Get-Mailbox -Database .
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 -Archive.
To get a list of all arbitration mailboxes in this database, run the command Get-Mailbox -Database -Arbitration.

To disable a non-arbitration mailbox so that you can delete the mailbox database, run the command Disable-Mailbox .
To disable an archive mailbox so you can delete the mailbox database, run the command Disable-Mailbox -Archive.
Arbitration mailboxes should be moved to another server; to do this, run the command New-MoveRequest .
If this is the last server in the organization, run the command Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed to disable the arbitration mailbox.
Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan -Database .

In other words, there are 4 possible causes:

  • Mailboxes
  • Mailbox plans
  • Archive mailboxes
  • Arbitration mailboxes

For each option, it’s giving you a command to test whether this is the problem and it’s giving you another command to solve it.

In my experience, it’s quite common for people to move all the normal mailboxes to another database, and think the original database is now empty, but they haven’t checked for arbitration mailboxes.

NB In some cases you can check all those things and still get the same error! See:
This mailbox database contains one or more mailboxes… – Microsoft Tech Community
That blog post refers to a scenario with an archive database.

I’ve also seen an issue with audit logs and monitoring:

[PS] C:\Windows\system32>Get-Mailbox -Database "DB02" -AuditLog

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

[PS] C:\Windows\system32>Get-Mailbox -Database "DB02" -Monitoring

Name                      Alias                ServerName ProhibitSendQuota
----                      -----                ---------- -----------------
HealthMailbox65306ed86... HealthMailbox6530... EXCHANGE1  Unlimited
HealthMailboxb4ab21f5d... HealthMailboxb4ab... EXCHANGE1  Unlimited
HealthMailbox200cb51a0... HealthMailbox200c... EXCHANGE1  Unlimited
HealthMailbox57029c4e0... HealthMailbox5702... EXCHANGE1  Unlimited

Again, these mailboxes would need to be moved/deleted before you can delete the database.

Leave a comment

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.