Recently I’ve been working with a customer where their DAG has been misbehaving.
The DAG was stretched between 2 AD sites. There were multiple issues with cluster resources in addition to the PAM (Primary Active Manager) not failing over properly
After looking at it for a few hours I decided that the best course of action would be to rebuild the DAG
The following are the steps required in order to remove the DAG and rebuild it
- Remove All Database Copies from the DAG
Remove-MailboxDatabaseCopy “DBName\ServerToRemove” –Confirm:$False
- Turn off DataCenter Activation Mode
Set-DatabaseAvailabilityGroup -Identity DAG1 -DatacenterActivationMode Off
- Remove the MailboxServers from the DAG
Remove-MailboxDatabaseAvailabilityServer DAG1 –MailboxServer ServerToRemove
Be sure to allow time for replication to occur between executing commands
- Recreate the DAG
New-DatabaseAvailabilityGroup -Name DAG1 –WitnessServer “WitnessServer” -WitnessDirectory D:\DAG1 -DatabaseAvailabilityGroupIpAddresses 192.168.100.100,192.168.101.100
- Add the servers back into the DAG
Add-DatabaseAvailabilityGroupServer -Identity DAG1 –MailboxServer “SourceMBXServer”
repeat this command for all servers that you wish to add
- Enable Database Activation Mode
Set-DatabaseAvailabilityGroup -Identity DAG1 -DatacenterActivationMode DAGOnly
- Finally Add the mailboxdatabase copy server
Add-MailboxDatabaseCopy –Identity DBName -MailboxServer MBXServerToAdd -ActivationPreference 2
- Finally we can test the Primary Active Manager Failover
Cluster.exe DAG1.DOMAIN.LOCAL Group “Cluster Group” /MoveTo:PassiveServerNode