skip to Main Content

Mailbox server cannot be removed from DAG

You like to remove a mailbox server from DAG (Database Availability Group). However, when performing the removal task, you get the error: Mailbox server cannot be removed from the Database Availability Group because mailbox database has multiple copies. Use Remove-MailboxDatabaseCopy either to remove the copy from this server or to remove the copies from other servers in the database availability group. Why is this happening, and what is the solution to remove the mailbox server from DAG?

Mailbox server cannot be removed from Database Availability Group

Sign in to Exchange admin center. Click on servers > database availability groups. Click in the list on the DAG and follow with the Manage DAG membership icon in the toolbar.

In our example, we have the following DAG configuration:

  • Name: DAG01-2016
  • Witness server: FS01-2016
  • Member servers: EX01-2016, EX02-2016
Mailbox server cannot be removed from DAG EAC

Click the member server in the list and click on the delete icon. In our example, it’s member server EX01-2016. Click on Save.

Mailbox server cannot be removed from DAG remove member server

You get the below error. It means that there are mailbox databases with database copies on the member server.

Mailbox server cannot be removed from DAG error

ERROR
Mailbox server ‘EX01-2016’ cannot be removed from the database availability group because mailbox database ‘DB01’ has multiple copies. Use Remove-MailboxDatabaseCopy either to remove the copy from this server or to remove the copies from other servers in the database availability group.

Solution to mailbox server cannot be removed from DAG

The solution to the error mailbox server cannot be removed from the database availability group because mailbox database has multiple copies is to remove the mailbox database copies from that Exchange Server. After that, you can remove the mailbox server from DAG.

Follow the below steps.

Step 1. Get mailbox database copies

Run Exchange Management Shell as administrator. Run the Get-MailboxDatabaseCopyStatus cmdlet to list the database copies.

[PS] C:\>Get-MailboxDatabaseCopyStatus * | sort Name | ft -AutoSize

Name           Status  CopyQueueLength ReplayQueueLength LastInspectedLogTime ContentIndexState
----           ------  --------------- ----------------- -------------------- -----------------
DB01\EX01-2016 Mounted 0               0                                      Healthy
DB01\EX02-2016 Healthy 0               0                 9/6/2021 8:43:53 PM  Healthy
DB02\EX01-2016 Healthy 0               0                 9/6/2021 8:07:23 PM  Healthy
DB02\EX02-2016 Mounted 0               0                                      Healthy
DB03\EX01-2016 Mounted 0               0                                      Healthy
DB03\EX02-2016 Healthy 0               0                 9/6/2021 8:43:32 PM  Healthy
DB04\EX01-2016 Healthy 0               0                 9/6/2021 8:09:48 PM  Healthy
DB04\EX02-2016 Mounted 0               0                                      Healthy

There are mailbox database copies mounted on the Exchange Server EX01-2016. You will get an error if you like to remove the database copy.

Step 2. Move mailbox database copies

Move all the database copies to another Exchange Server. Read more on how to perform a server switchover with PowerShell.

[PS] C:\>Move-ActiveMailboxDatabase -Server "EX01-2016" -ActivateOnServer "EX02-2016" -SkipMoveSuppressionChecks -Confirm:$false

Step 3. Remove mailbox database copy

Run the Remove-MailboxDatabaseCopy cmdlet. Specify the database and Exchange Server.

[PS] C:\>Remove-MailboxDatabaseCopy -Identity "DB01\EX01-2016" -Confirm:$false
WARNING: The copy of mailbox database "DB01" on server "EX01-2016" has been removed. If necessary, manually delete the database copy's files located at "F:\DB01" and "E:\DB01\DB01.edb" on that server.

Step 4. Remove mailbox database copies from particular Exchange Server

If you want to speed up the database copy removal, select the DAG member server and remove all the mailbox database copies.

[PS] C:\>Get-MailboxDatabaseCopyStatus -Server "EX01-2016" | Remove-MailboxDatabaseCopy -Confirm:$false
WARNING: The copy of mailbox database "DB02" on server "EX01-2016" has been removed. If necessary, manually delete the database copy's files located at "H:\DB02" and "G:\DB02\DB02.edb" on that server.
WARNING: The copy of mailbox database "DB03" on server "EX01-2016" has been removed. If necessary, manually delete the database copy's files located at "J:\DB01" and "I:\DB03\DB03.edb" on that server.
WARNING: The copy of mailbox database "DB04" on server "EX01-2016" has been removed. If necessary, manually delete the database copy's files located at "L:\DB04" and "K:\DB04\DB04.edb" on that server.

Step 5. Verify that there are no mailbox database copies mounted

Run the Get-MailboxDatabaseCopyStatus cmdlet and verify that you don’t see the Exchange Server in the list.

[PS] C:\>Get-MailboxDatabaseCopyStatus * | sort Name | ft -AutoSize

Name           Status  CopyQueueLength ReplayQueueLength LastInspectedLogTime ContentIndexState
----           ------  --------------- ----------------- -------------------- -----------------
DB01\EX02-2016 Mounted 0               0                                      Healthy
DB02\EX02-2016 Mounted 0               0                                      Healthy
DB03\EX02-2016 Mounted 0               0                                      Healthy
DB04\EX02-2016 Mounted 0               0                                      Healthy

Step 6. Remove mailbox server from DAG

Remove the mailbox member server from DAG. In our example, it’s the Exchange Server EX01-2016 and DAG DAG01-2016.

[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity "DAG01-2016" -MailboxServer "EX01-2016" -Confirm:$false

If the Exchange mailbox server is lost and can’t be contacted, you need to use the ConfigurationOnly switch. An example is when the Exchange mailbox server fails to start.

[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity "DAG01-2016" -MailboxServer "EX01-2016" -ConfigurationOnly -Confirm:$false

That’s it!

Read more: Add mailbox database copy »

Conclusion

In this article, you learned how to remove a mailbox server from a DAG configuration. It’s essential to remove the mailbox database copies before removing the member server from DAG. If you don’t do that first, an error shows up that the mailbox server cannot be removed from Database Availability Group.

Did you enjoy this article? You may also like the course Exchange Server high availability. 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 0 Comments

Leave a Reply

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