Removing a mailbox server from an Exchange Server with Database Availability Group (DAG) setup is quite easy. However, it may block or disable the automatic failover protection and database recovery.
Thus, it is not recommended to remove a mailbox server from DAG unless you encounter issues with the mailbox server, need to upgrade the server hardware, use the server as standalone, or decommission it. You may also want to remove a mailbox server from DAG if it fails.
You don’t need to remove a mailbox server from DAG to install or apply Cumulative or Security Updates. In this case, you can move the active copy of the database to another mailbox server in DAG and disable ‘DatabaseAutoActivationPolicy’. You can then put the member server in maintenance mode and apply the updates.
In this article, we will be discussing the step-by-step procedure to safely remove and decommission an Exchange 2010, 2013, 2016, or 2019 mailbox server from DAG using the Exchange Admin Center (EAC) and PowerShell cmdlets in the Exchange Management Shell (EMS).
We will also address a few common errors you may encounter while removing an Exchange mailbox server from DAG.
Steps to Remove Mailbox Server from DAG
You can remove a mailbox server from DAG via Exchange Admin Center (EAC) in Exchange 2013 and later versions and using Exchange Management Shell (EMS) in Exchange Server 2010 SP1. EMS also comes in handy to resolve or overcome errors you may encounter while removing the mailbox server from DAG.
Assign Roles and Permissions
To add or remove the mailbox server from DAG, you need specified roles and permissions. So, check if the required roles and permissions are assigned and available to your user account. For this, open EMS as administrator and run the following command:
Get-ManagementRoleAssignment -Role "Database Availability Groups" -GetEffectiveUsers
The output will display if the required role and permission are assigned to your or other user accounts. If not, you can assign the role by using the following cmdlet:
New-ManagementRoleAssignment -Role "Database Availability Groups" –User "Administrator"
Replace “Administrator” with your user name to assign the required role.
Remove Mailbox Server from DAG via the Exchange Admin Center (EAC)
Login to Exchange Administrative Center (EAC) and then follow these steps:
- Go to servers > database availability groups.
- Select the DAG and click the ‘Manage DAG membership‘ icon.
- Select the mailbox server from the ‘Manage database availability group membership‘ list that you want to remove.
- Click the ‘Remove‘ (- icon) button and then click ‘Save.’
- Exchange will start the process of removing the selected mailbox server from the DAG. This may take a while.
Remove Mailbox Server from DAG via Exchange Management Shell
The steps to remove a mailbox server from Database Availability Group using Exchange Management Shell (EMS) cmdlets are as follows:
- Open Exchange Management Shell (EMS) as administrator.
- Check the mailbox servers and database health status information by running the following command:
- If the status is healthy, run the following cmdlets to remove the desired mailbox server from the DAG:
Get-MailboxDatabaseCopyStatus -Server "Exch19-01" | Remove-MailboxDatabaseCopy -Confirm:$false
Change “Exch19” with your Exchange Server name that you want to remove from DAG.
- Then run the following command to remove the mailbox server from the DAG:
Remove-DatabaseAvailabilityGroupServer -Identity DC03 -MailboxServer Exch19-01
You may encounter an error message while removing a mailbox server from the DAG, such as:
Mailbox server ‘Exch19’ cannot be removed from the database availability group because the mailbox database ‘Mailbox19’ 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.
The database”XXXXX” is currently hosted on server”XXXX”. Use Move-ActiveMailboxDatabase to move the active copy of the database to a different server.
These errors occur when the mailbox server you want to remove holds a replicated or active copy of the mailbox database.
In such a case, follow these steps to remove the mailbox server:
Step 1: Check Mailbox Database Copies
To check mailbox database copies, run the following command in the EMS:
Step 2: Move Database Copies
Move the mailbox database from the Exchange Server you want to remove from DAG to another member server in DAG by running the below command:
Move-ActiveMailboxDatabase -Server "Exch19-01" -ActivateOnServer "Exch19-02" -SkipMoveSuppressionChecks -Confirm:$false
Step 3: Remove All Database Copies from Mailbox Server
Then remove the database copy from the Exchange Server that you want to remove from DAG. Run this command:
Get-MailboxDatabaseCopyStatus -Server "EXCH19-01" | Remove-MailboxDatabaseCopy -Confirm:$false
Step 4: Dismount Database Copies
Use Get-MailboxDatabaseCopyStatus cmdlet to check no database copies present on the mailbox server you want to remove are mounted.
Step 5: Remove Mailbox Server from DAG
Finally, use EAC to remove the mailbox server as discussed earlier or execute the following command to remove the mailbox server from the DAG:
Remove-DatabaseAvailabilityGroupServer -Identity "DAG01" -MailboxServer "EXCH19-01" -ConfigurationOnly -Confirm:$false
This should remove the mailbox server from the DAG.
You may now remove the mailbox databases from the removed mailbox server and then decommission the mailbox server by uninstalling it.
Database Availability Group (DAG) is a disaster recovery feature in Exchange Server architecture that provides automatic failover recovery at the database level after a database, server, or network failure.
You can create a DAG and add up to 16 Exchange mailbox servers to the group. The member mailbox servers in DAG monitor each other for failure in real-time and utilize continuous replication technology to provide site resilience and high availability.
However, if you want to remove a mailbox server from DAG for any reason, follow the steps discussed in this article.