Exchange: Can’t Delete a Database

KB ID 0001414

Problem

Every iteration of Exchange comes up with some new system/hidden mailbox type that stops me deleting mailbox databases!

This mailbox database contains one or more mailboxes,

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

 

Solution

OK, I’m assuming you don’t actually have any mailboxes in the database? The following will tell you;

Get-Mailbox -Database “Database-Name

If you are running Exchange 2016 you might have an AudiLog account;

Get-Mailbox -Auditlog -Database “Database-Name

Or a Monitoring Mailbox

Get-Mailbox -Monitoring -Server “Server-Name

For 2013 (and older) the likely culprits are Arbitration, Archive, or Discovery Search mailboxes, (the latter you need an extra command to see).

Get-Mailbox -Auditlog -Database “Database-Name” -Arbitration

Get-Mailbox -Auditlog -Database “Database-Name” -Archive

Set-AdServerSettings -ViewEntireForest $true

Get-Mailbox -Database “Database-Name

To move a Discovery Search Malbox

Get-Mailbox DiscoverySearchMailbox* | New-MoveRequest -TargetDatabase “Target-Database

Also Exchange 2013 or Newer may have one or more Public folder mailboxes;

Get-Mailbox -PublicFolder | New-MoveRequest -TargetDatabase “Target-Database

I Can’t Find Anything and it still Wont Let Me Delete the Datastore?

Well, there’s two things you can do;

1. On a Domain Controller, 0pen ADSIEdit.msc and Connect to ‘Configuration’. Navigate to Configuration > Services > Microsoft Exchange > {Organisation name} > Administrative Groups > {Administrative-Group-Name} > Databases  >Delete the database from here (BE CAREFUL CHECK TWICE, DELETE ONCE!). Then have a coffee refresh you datastore view and the offender will disappear.

ADSIEdit Delete Mailbox Database

2. With the database dismounted, move its .edb file to another folder, then mount the store, it will complain and ask if you want to mount and empty store > select ‘yes’ > You can then delete it.

 

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

9 Comments

  1. Thanks for this, my Exchange org sits in a root domain, but the servers are in a child domain. I had to use the Set-AdServerSettings -ViewEntireForest $true command to be able to see the hidden mailboxes. I think you’re the only person that suggests this.

    Also, what’s with your blog’s banner image?? You’ve got the US flipped so the west coast is facing Europe – bizzare! 🙂

    Post a Reply
    • Banner Image: I’ve never noticed that before? Ive not used that image for a while!

      Glad I could help you out.

      P

      Post a Reply
  2. Thank you so much, that worked for me, your articles are always the best

    Post a Reply
  3. Only the brute force works for me:

    1. On a Domain Controller, 0pen ADSIEdit.msc and Connect to ‘Configuration’. Navigate to Configuration > Services > Microsoft Exchange > {Organisation name} > Administrative Groups > {Administrative-Group-Name} > Databases >Delete the database from here (BE CAREFUL CHECK TWICE, DELETE ONCE!). Then have a coffee refresh you datastore view and the offender will disappear.

    Thanks a lot

    Post a Reply
  4. Hi Pete,

    Your command above is missing a ‘t’ in Arbitration.

    Also useful is the command to move the Arbitration mailboxes to a different database.

    Get-Mailbox –Database “Mailbox Database 02” –arbitration | New-MoveRequest –TargetDatabase “Mailbox Database 03”

    Post a Reply
  5. ADSIEDIT option worked for me

    Thanks

    Post a Reply
  6. Hi, I couln’t remove the last database on my Exchange 2016.
    It was an AD Account misconfigured:
    recipienttypedetails attribute of this account was set to 2147483648(RemoteUserMailbox) instead of 1 (UserMailbox) so the get-mailbox -database returns nothing.

    I set to 1 and I could move this mailbox to Exchange 2019, and could delete this DB.

    To find this account:

    – Find homemdb attribute with the name of database
    – Dismount database, copy, and open it with an EDB Explorer (be aware, recently disconnected mailboxes are shown)

    Post a Reply
  7. 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.

    Post a Reply

Leave a Reply to Hugo Muñoz Cancel reply

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