When you are running an Exchange 2013 database availability group in your environment you may have a need to remove one of the servers from the DAG, for example during decommissioning of server hardware.
If you were to try and simply uninstall Exchange 2013 from the server you would encounter an error during the readiness checks.
This computer is a member of a database availability group (DAG). It must be removed from the DAG before you can uninstall Exchange.
Following that advice if you were to try and remove the server from the DAG you may encounter this error.
Mailbox server ‘E15MB3’ cannot be removed from the database availability group because mailbox database ‘Mailbox Database 1’ 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.
By now I’m sure you realise that there is a process that needs to be followed before you can uninstall Exchange 2013 from the DAG member.
- Removing database copies
- Removing the Exchange server from the DAG
Let’s take a look at those steps in more detail.
Removing Database Copies
The first part of the process is the removal of database copies. There are actually two approaches here.
- If you are planning to remove the server from the DAG but keep it as a standalone server hosting databases, then any copies of those databases must be removed from other DAG members first.
- If you are planning to completely uninstall Exchange 2013 from the server then any database copies should be removed from the server that is being uninstalled.
Technically you could use the first approach even if you plan to completely uninstall the server, but even after removing the server from the DAG you won’t be able to uninstall Exchange 2013 if it still hosts databases that contain mailboxes.
See Exchange 2013 Database Removal Error: “This mailbox database contains one or more mailboxes” for more information.
So it makes sense to use the second approach for a server that is being completely decommissioned, which is the scenario I will be using for the rest of this tutorial.
In the Exchange Admin Center navigate to Servers -> Databases and select a database that has a copy on the server you are removing from the DAG.
If it happens to be the active database copy you would see an error and you must first switchover the database to another DAG member.
The database “Mailbox Database 3” is currently hosted on server “E15MB3”. Use Move-ActiveMailboxDatabase to move the active copy of the database to a different server.
Click the Remove link for the database copy.
If you have multiple database copies to remove you can use this PowerShell command to remove them all. Again, this command won’t work if the database copy is active or if it is the only copy of the database.
[PS] C:\>Get-MailboxDatabaseCopyStatus -Server E15MB3 | Remove-MailboxDatabaseCopy
Removing the Server from the Database Availability Group
After removing all database copies from the DAG member the next step is to remove it from the DAG itself.
In the Exchange Admin Center navigate to Servers -> Database Availability Groups. Select the DAG and click the Manage DAG Membership button.
Highlight the server name and click the Remove button.
Click Save to complete the removal process.
You can also remove the DAG member using PowerShell.
[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity E15DAG -MailboxServer E15MB3
Removing Exchange Server 2013
Now that the Mailbox server has no databases and has been removed from the DAG, and assuming the server performs no other roles in your organization, you can uninstall Exchange 2013.