RecoverServer Error: Exchange server is a member of a database availability group
Exchange server recovery process aborts with the error “Exchange server is a member of a database availability group”
Setup.com /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.
[PS] C:\Windows\system32>Remove-DatabaseAvailabilityGroupServer –Identity DAG1 -MailboxServer EXCH-03 -ConfigurationOnly
WARNING: The operation wasn’t successful because an error was encountered. You may find more details in log file “C:\ExchangeSetupLogs\DagTasks\dagtask_2013-10-29_13-42-12.346_remove-databaseavailabiltygroupserver.log”.
Remove-DatabaseAvailabilityGroupServer : Mailbox server ‘EXCH-03’ cannot be removed from the database availability group because mailbox database ‘Database3’ 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.
At line:1 char:39
+ Remove-DatabaseAvailabilityGroupServer <<<< -Identity DAG1 -MailboxServer EXCH-03 -ConfigurationOnly
+ CategoryInfo : InvalidArgument: (:) [Remove-DatabaseAvailabilityGroupServer], RemoveDagServer…icatedException
+ FullyQualifiedErrorId : 5FB7622C,Microsoft.Exchange.Management.SystemConfigurationTasks.RemoveDatabaseAvailabilityGroupServer
Details:
In theory, if the crashed server is a part of a DAG we cannot recover it before we remove it from the DAG. However, if the mailbox server is holding any MailboxDatabaseCopy we cannot remove it from the DAG. So, we need to first remove all Database copies hosted on that server and then remove it from the DAG.
If you lost just one server from a group of servers in DAG, we can remove database copies of the crashed server from an existing server and then remove the server from DAG. Then run the setup again.
EXCH-03 is my crashed server here.
To do this,
Get-MailboxDatabaseCopyStatus *\EXCH-03
Get-MailboxDatabaseCopyStatus *\EXCH-03 | Remove-MailboxDatabaseCopy -Confirm
Remove-DatabaseAvailabilityGroupServer -Identity DAG1 -MailboxServer EXCH-03 –ConfigurationOnly
ConfigurationOnly switch will clean the configuration from Active Directory
If you do not have any Exchange servers left or your one and ONLY exchange server crashed then you need to delete the configuration after you make a note of all databasenames and other details.
This is an equal as starting fresh. If you have a backup, you may attempt to restore it “after” we are done with the recovery process.
So, install Exchange Management tools on a machine in domain for us to run Exchange management Shell.
Before you proceed, please make a note of the msexchInstallPath (ADSIEdit: 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) and ensure it is set to the correct value or use the /TargetDir Setup switch to specify the location of the Exchange program files. If you don’t use the /TargetDir switch, the Exchange program files will be installed in the default location (%programfiles%\Microsoft\Exchange Server\V15).
Now reset the server’s computer account in Active Directory.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-MailboxDatabaseCopyStatus *\EXCH-03 (will get you a list of all databases which used to reside on that server. Make a copy NOW)
Get-MailboxDatabaseCopyStatus *\EXCH-03 | Remove-MailboxDatabaseCopy –Confirm (Know what you are doing)
Remove-DatabaseAvailabilityGroupServer -Identity DAG1 -MailboxServer EXCH-03 –ConfigurationOnly
Now Start the recovery again and it should work alright:
Preparing Exchange Setup
Copying Setup Files COMPLETED
The following server roles will be recovered
Languages
Hub Transport Role
Client Access Role
Mailbox Role
Management Tools
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 COMPLETED
Configuring Microsoft Exchange Server
Preparing Setup COMPLETED
Stopping Services COMPLETED
Copying Exchange Files COMPLETED
Language Files…………………………….
Once recovery is completed, add the server back to DAG and add all mailboxdatase copies and let it seed.
Add-DatabaseAvailabilityGroupServer -Identity DAG1 -MailboxServer EXCH-03
Add-MailboxDatabaseCopy -Identity Database3 -MailboxServer EXCH-03
Once the database is seeded alright, perform a failover off business hours and ensure all is up and running.
Ratish Nair
Microsoft MVP | Exchange Server
Team @MSExchangeGuru.com