Administrators can add or remove an Exchange Server from a Database Availability Group (DAG) by using the Exchange Admin Center (EAC) or PowerShell cmdlets in Exchange Management Shell (EMS). However, there is a process to add or remove a member Exchange Server to or from a DAG.
If the process is not followed, you may encounter an error message while removing the member Exchange Server from DAG, such as:
“Mailbox server ‘EXCHSRV01’ cannot be removed from the Database Availability Group because mailbox database ‘DB01’ has multiple copies.”
The error message further mentions, “Use Remove-MailboxDatabaseCopy cmdlet to remove the copy from this server or to remove copies from other servers in the database availability group.”
Solutions to Resolve Mailbox Server Cannot be Removed from DAG Error
A database in DAG may have multiple copies stored across member servers for redundancy. You must remove all the database copies from the member Exchange Server that you want to remove from the DAG. Otherwise, you will encounter an error message.
Follow the steps below to safely remove the Exchange Mailbox Server from a Database Availability Group.
Step 1: Check the Database Copies
First, you need to check which database copies are stored on the mailbox server that you want to remove from the DAG. Once you have the database list, you can remove the copies from the server and then remove the server from the DAG without any errors or issues.
Use the Get-MailboxDatabaseCopyStatus cmdlet to get the list of all database copies.
Get-MailboxDatabaseCopyStatus * | sort Name | ft –AutoSize
In the above image, you can see that there are database copies on the Exchange mailbox server EXCHSRVIB1. If we try to remove the database copies, we will get an error message.
Step 2: Move Database Copies
Before you can remove the database copies, you must move all active database copies to a different Exchange mailbox server. Otherwise, you will encounter another error message.
To move a mailbox database, you can use the Move-ActiveMailboxDatabase cmdlet.
Move-ActiveMailboxDatabase -Server "EXCHSRVIB02" -ActivateOnServer "EXCHSRVIB01" -SkipMoveSuppressionChecks -Confirm:$false
Repeat the above to move all active database copies.
Step 3: Remove Database Copy from the Server
Once the mailbox database active copies are moved, you can use the Remove-MailboxDatabaseCopy command to remove the database copies from the mailbox server.
Remove-MailboxDatabaseCopy -Identity "DatabaseIdentity\ServerIdentity"
For instance,
Remove-MailboxDatabaseCopy -Identity "MBXDB01\EXCHSRVIB01"
You will receive a warning. Type Y and press Enter to confirm. The database copy will be removed from the server.
Repeat the step to remove all database copies from the mailbox server.
Alternatively, you can use the following command to remove all database copies from the mailbox server at once.
Get-MailboxDatabaseCopyStatus -Server "EXCHSRVIB01" | Remove-MailboxDatabaseCopy -Confirm:$false
Step 4: Again Check Database Copies Status
Check that the mailbox server you want to remove from the DAG does not have any active database copies. Use the following command:
Get-MailboxDatabaseCopyStatus * | sort Name | ft –AutoSize
If the output does not display the mailbox server name you need to remove, you can go ahead and remove the mailbox server. If you see any database copy on the server with healthy or mounted status, remove the database copy and then proceed to the next step.
Step 5: Remove the Server from DAG
To remove the mailbox server from DAG with no active or mounted database copies, you can use the Exchange Admin Center (EAC) or Remove-DatabaseAvailabilityGroupServer PowerShell cmdlet in the Exchange Management Shell (EMS).
Remove-DatabaseAvailabilityGroupServer -Identity DAG01 -MailboxServer EXCHSRVIB1
To speed up the removal process, you can run the following command:
Remove-DatabaseAvailabilityGroupServer -Identity "DAG01" -MailboxServer "EXCHSRVIB01"
When prompted, type Y and press the Enter key.
If you want to use the Exchange Admin Center (EAC) to remove the member server, follow these steps:
- Open the EAC and log in as administrator.
- Go to servers > database availability groups and then select the DAG.
- Click the Manage DAG Membership.
- Select the Exchange Server you want to remove and click the Remove (-).
- Click Save. The mailbox server will be removed from the DAG.
Conclusion
The error message “cannot be removed from the database availability group” appears when you try to remove a member Exchange Server from DAG. To avoid this error, you must remove the active database copies from the mailbox server. The article shares steps and cmdlets you can use to safely remove the mailbox server from a Database Availability Group (DAG) after removing the database copies. If you still can’t remove the server, you can use an Exchange server recovery software, such as Stellar Repair for Exchange to move the users’ mailboxes from your faulty DAG member server to a database on a different member server. The software can extract and export the mailboxes of users from corrupt, inaccessible, and offline mailbox databases on the faulty server to a healthy server in your DAG directly. After moving the mailboxes, you can remove and decommission the Exchange Server.
Was this article helpful?