Error Solved: “Exchange server is a member of a database availability group”

Summary: This guide helps you fix the Exchange server recovery error “Exchange server is a member of a database availability group” by using the PowerShell commands. After fixing the problem that causes this error, you can proceed to recover the crashed or failed Exchange server.

Database Availability Group or DAG is a critical base component of the Exchange Mailbox server environment. DAG is basically a set of up to 16 Exchange mailbox servers which maintains several copies of Exchange Mailbox database to ensure high availability. It stores these copies of database files on other member servers of same Database Availability Group.

To be a member of DAG, the server must be running on the same Exchange version. This helps in disaster recovery and restore a failed or corrupt Exchange database or member server when required.

Why “Exchange server is a member of a database availability group” Error Appears?

The error message, “Exchange server is a member of a database availability group” appears when the server recovery process fails as Exchange setup encounters an error.

The error appears specifically when admin or Exchange user runs the Setup /m:RecoverServer cmdlet to recover a failed Exchange server. The error reads,

Setup /m:RecoverServer
Performing Microsoft Exchange Server Prerequisite Check
Configuring Prerequisites COMPLETED
Language Pack Checks COMPLETED
Hub Transport Role Checks COMPLETED
Client Access Role Checks COMPLETED
Mailbox Role Checks FAILED
Exchange server is a member of a database availability group.
The Exchange Server setup operation didn’t complete. More details can be found in ExchangeSetup.log located in the <SystemDrive>:\ExchangeSetupLogs folder.
Exchange Server setup encountered an error.

This indicates that the crashed server, that user is trying to recover with RecoverServer /m switch, is a part of DAG that you cannot recover unless you remove the crashed server from the group (DAG). The problem becomes more complex when the mailbox server is storing a copy of the mailbox database.

Thus, you will need to first remove all the mailbox database copies from the server. You must also check and remove the copy of databases of a failed server that you want to recover from other member servers. Only then you can remove the server from DAG and resolve the error.

Once the error is fixed and the server is restored, you can add the recovered server back to the DAG.

So now that we have covered the theoretical part of the error, let’s jump into the practical approach and fix the Exchange server is a member of a database availability group error.

Read How to use Setup /m:RecoverServer to restore failed Exchange server to know more.

Steps to Fix Exchange server is a member of a database availability group

Consider the server that crashed, which you are trying to restore, is ExServ01.To fix the error, run following commands in the PowerShell.

NOTE: You will need permission to execute these commands. Before proceeding, read this to assign the required permission to the user account that you are going to use.

Remove the database of crashed server ExServe01 from the DAG by using following commands,

Get-MailboxDatabaseCopyStatus *\ExServ01
Get-MailboxDatabaseCopyStatus *\ExServ01 | Remove-MailboxDatabaseCopy -Confirm
Remove-DatabaseAvailabilityGroupServer -Identity DAG01 -MailboxServerExServ01 –ConfigurationOnly

NOTE: Use of ConfigurationOnly switch is important as it cleans all the configurations from Active Directory.

At this stage, you need to note all the configuration settings of the server, database names, and other details. Then create a new server and use the same configuration and version that were on the crashed server. You can also delete the Exchange configuration from the crashed server and start afresh by installing the Exchange Management tools. The Exchange Management tools are necessary to run the Exchange Management Shell to proceed further.

Use the /TargetDir switch to specify the install location of Exchange if it is installed on a location other than the default one, which is C:/Program Files/Microsoft/Exchange Server/V…

If you don’t know the install location, follow these steps to find out,

  1. Launch ADSIEDIT.MSC and navigate to
CN=ExServerName, CN=Servers, CN=First Administrative Group, CN=Administrative Groups,CN=ExOrg Name,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DomainName,CN=Com
  • Right-click on the Exchange server object, and then choose Properties.
Recover Exchange Server after total loss - SuperTekBoy
  • Double click on msExchInstallPath attribute to view and copy the current Exchange installation path

Once the Exchange Management tools are installed, reset the server’s account in AD (Active Directory) by following these steps.

Then open the Exchange Management Shell and enter the following command to start the recovery process again.

Setup /m:RecoverServer

This time, it should work and complete the recovery process. After the command executes successfully, you can add the recovered server back to DAG.

In case this still doesn’t work in your case, there might be an issue with the Exchange Active Directory or configuration settings. You can use the Exchange repair utility such as Stellar Repair for Exchange to avoid such situations.

By using this software, you can directly scan, repair and export the mailbox database to the new recovery server that you setup. This powerful Exchange repair software helps you recover dismounted or offline Exchange database files. It scans and repairs the corrupt Exchange Database (EDB) file and restores all mailbox items, such as emails, attachments, contacts, calendars, notes, tasks, journals, & public folders, directly to Live Exchange Server or Office 365.[RS4] 

free download

Add Recovered Server Back to Database Availability Group (DAG)

After the Setup recovery process is complete, add the recovered server to the DAG by using the Add-DatabaseAvailabilityGroupServer cmdlet:

Add-DatabaseAvailabilityGroupServer -Identity DAG01 -MailboxServer ExServ01

Reconfigure and Add Database Copies on Member Servers

Once the server is added back to the DAG, use the following command to reconfigure and add all mailbox database copies,

Add-MailboxDatabaseCopy -Identity EXCHDB1 -MailboxServer ExServe01

To check if you’ve successfully added the recovered server back to DAG, follow these steps,

  • Open Exchange Management Shell and run the following command,
Test-ReplicationHealth <ServerName>
Get-MailboxDatabaseCopyStatus -Server <ServerName>
  • This will check the status of the recovered DAG member. If all health tests are passed successfully and the status is displayed as healthy, it means the recovered server is now a member of DAG and is in working state.

Conclusion

The error, Exchange server is a member of a database availability group, can be easily resolved by executing a few PowerShell commands in Exchange Management Shell (EMS). This detailed guide explains the process with stepwise instructions to restore a failed or crashed Exchange server by fixing this error. However, in some cases, it might not work due to problem with server configuration and Active Directory.

For those cases, you can use the Exchange repair utility from Stellar® and recover the user mailboxes from the EDB files on the failed Exchange server. The GUI-based software helps you restore user mailboxes from the EDB files of a crashed server to the new Live Exchange server with a few mouse-clicks. It also repairs corrupt or inaccessible EDB file which makes it an ideal solution to fix common Exchange errors without much troubleshooting. Plus, it also helps avoid any data loss that may happen during troubleshooting.