AlwaysOn Availability Group Listener Cannot be Created or Failed Over on Node if 'Primary DNS suffix' is not set
AlwaysOn availability groups will not function properly on Windows servers where the system's 'Primary DNS Suffix of this Computer' is not set. Usually, the Primary DNS Suffix is populated when a Windows server joins a domain.
Create Listener on Windows server without ‘Primary DNS suffix’ fails
Attempting to create the availability group listener will fail when the node hosting the primary replica has ‘Primary DNS Suffix of this Computer’ cleared. SQL Server will fail to create the listener and report:
When issuing ALTER AVAILABILITY GROUP…ADD LISTENER, the message reads:
Msg 19471, Level 16, State 0, Line 1
The WSFC cluster could not bring the Network Name resource with DNS name 'aglisten' online. The DNS name may have been taken or have a conflict with existing name services, or the WSFC cluster service may not be running or may be inaccessible. Use a different DNS name to resolve name conflicts, or check the WSFC cluster log for more information.
Msg 19476, Level 16, State 4, Line 1
The attempt to create the network name and IP address for the listener failed. The WSFC service may not be running or may be inaccessible in its current state, or the values provided for the network name and IP address may be incorrect. Check the state of the WSFC cluster and validate the network name and IP address with the network administrator.
Reviewing the cluster log on the server where the listener failed to create, errors report that the fully qualified name could not be acquired:
00000280.00000060::2015/03/16-15:47:41.463 INFO [RCM] rcm::RcmGum::CreateResource(ag_aglisten,d2881a8e-7c36-4c8f-a17c-d4cef149e355,ag)
...
00000d70.00000a88::2015/03/16-15:47:46.081 INFO [RES] Network Name <ag_aglisten>: AccountAD: OU name for VCO is CN=Computers,DC=AGDC,DC=COM
...
00000d70.00000a88::2015/03/16-15:47:46.266 ERR [RES] Network Name: [NNLIB] Getting FQDN failed with error 87
00000d70.00000a88::2015/03/16-15:47:46.266 INFO [RES] Network Name: [NN] IdentityLocal End Impersonating
00000d70.00000a88::2015/03/16-15:47:46.266 INFO [RES] Network Name <ag_aglisten>: AccountAD: OnInitializeEnd: 87
00000d70.00000a88::2015/03/16-15:47:46.266 INFO [RES] Network Name <ag_aglisten>: AccountAD: Slow Operation, FinishWithReply: 87
...
00000d70.00000a88::2015/03/16-15:47:46.282 INFO [RES] Network Name: Agent: OnInitializeReply, Failure on (d2881a8e-7c36-4c8f-a17c-d4cef149e355,Configuration): 87
00000d70.00000a88::2015/03/16-15:47:46.282 INFO [RES] Network Name <ag_aglisten>: SyncReplyHandler Configuration, result: 87
00000d70.00000464::2015/03/16-15:47:46.282 INFO [RES] Network Name <ag_aglisten>: PerformOnline - Initialization of Configuration module finished with result: 87
00000d70.00000464::2015/03/16-15:47:46.282 ERR [RES] Network Name <ag_aglisten>: Online thread Failed: ERROR_SUCCESS(0)' because of 'Initializing netname configuration for ag_aglisten failed with error 87.'
00000d70.00000464::2015/03/16-15:47:46.282 INFO [RES] Network Name <ag_aglisten>: All resources offline. Cleaning up.
00000d70.00000464::2015/03/16-15:47:46.282 ERR [RHS] Online for resource ag_aglisten failed.
Availability Group failover to Server without ‘Primary DNS suffix’ fails
Attempting to failover an availability group which also has a listener defined, to a Windows server where ‘Primary DNS suffix of this computer’ is not set, fails. When attempting to issue transact-sql ALTER AVAILABILITY GROUP…FAILOVER or ALTER AVAILABILITY GROUP…FAILOVER_ALLOW_DATA_LOSS the command fails with the following messages:
Msg 41066, Level 16, State 0, Line 1
Cannot bring the Windows Server Failover Clustering (WSFC) resource (ID 'a8aa7c13-4b9c-4423-bc68-6e90a81d0c21') online (Error code 5942). The WSFC service may not be running or may not be accessible in its current state, or the WSFC resource may not be in a state that could accept the request. For information about this error code, see "System Error Codes" in the Windows Development documentation.Msg 41160, Level 16, State 0, Line 1
Failed to designate the local availability replica of availability group 'ag' as the primary replica. The operation encountered SQL Server error 41066 and has been terminated. Check the preceding error and the SQL Server error log for more details about the error and corrective actions.
Checking the cluster log on the Windows server which could not be failed over to, reports the following errors:
00000280.00000b08::2015/03/16-16:28:33.624 INFO [RCM] rcm::RcmApi::MoveGroup: (ag, 1, 0, MoveType::Manual )
00000280.00000db4::2015/03/16-16:28:33.670 INFO [NM] Received request from client address SQLNODE2.
00000280.00000190::2015/03/16-16:28:33.670 INFO [RCM] rcm::RcmApi::OnlineResource: (ag, 0)
00000280.00000190::2015/03/16-16:28:33.670 INFO [RCM-rbtr] giving default token to group ag
00000280.00000190::2015/03/16-16:28:33.670 INFO [RCM] rcm::RcmResource::Online: bringing ag's provider resource 'ag_aglisten' online.
...
00000d70.00000c94::2015/03/16-16:28:33.686 WARN [RES] Network Name: [NNLIB] AddServerName - Getting Computer Domain failed, error 203
...
00000d70.00000f54::2015/03/16-16:28:33.827 INFO [RES] Network Name <ag_aglisten>: PerformOnline - Initialization of Configuration module finished with result: 203
00000d70.00000f54::2015/03/16-16:28:33.827 ERR [RES] Network Name <ag_aglisten>: Online thread Failed: ERROR_SUCCESS(0)' because of 'Initializing netname configuration for ag_aglisten failed with error 203.'
00000d70.00000f54::2015/03/16-16:28:33.827 INFO [RES] Network Name <ag_aglisten>: All resources offline. Cleaning up.
00000d70.00000f54::2015/03/16-16:28:33.827 ERR [RHS] Online for resource ag_aglisten failed.
Check the ‘Primary DNS suffix of this computer’ setting’
You can find this setting under Control Panel’s System and Security, by clicking System and then the Change settings link. Then click the Change button in the System Properties, the More button in the Computer Name/Domain Changes dialog to view the ‘Primary DNS suffix of this computer’ setting.
NOTE Setting the DNS suffix will require a reboot of the server.
Enter the correct suffix for the server:
This problem may exist on other nodes in the cluster. Be sure to check all the nodes hosting replicas in the availability group, otherwise, you will be unable to failover your availability group and listener to that node. Ensure that the DNS suffix has been properly set on all the Windows cluster nodes that might be a failover target for your availability group.