Sometimes there are errors which give us the solution to the problem and I love to discover other ways to fix it. In this blog, we would learn how to fix Failed to create the Windows Server Failover Clustering (WSFC) resource with name and type ‘SQL Server Availability Group’
Here is the exact error which I received while creating an availability group:
Msg 41105, Level 16, State 0, Line 3
Failed to create the Windows Server Failover Clustering (WSFC) resource with name ‘SQLAUTHORITY_AG’ and type ‘SQL Server Availability Group’. The resource type is not registered in the WSFC cluster. The WSFC cluster many have been destroyed and created again. To register the resource type in the WSFC cluster, disable and then enable Always On in the SQL Server Configuration Manager.
Msg 41152, Level 16, State 2, Line 3
Failed to create availability group ‘SQLAUTHORITY_AG’. The operation encountered SQL Server error 41105 and has been rolled back. Check the SQL Server error log for more details. When the cause of the error has been resolved, retry CREATE AVAILABILITY GROUP command.
The T-SQL which I used was as follows.
USE [master] GO CREATE AVAILABILITY GROUP [SQLAUTHORITY_AG] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY, DB_FAILOVER = OFF, DTC_SUPPORT = NONE, REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT = 0) FOR DATABASE [SQLAUTHORITY_DB] REPLICA ON N'NODE1' WITH (ENDPOINT_URL = N'TCP://NODE1.SQLAUTHORITY.COM:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 50, SEEDING_MODE = MANUAL, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); GO
Here is the screenshot of the error message.
I checked ERRORLOG and there were no messages. As the error message says, “The resource type is not registered in the WSFC cluster” so I checked the PowerShell to get resource type and found below.
Get-ClusterResourceType | where name -like "SQL Server Availability Group"
The output showed no result which means the error message is correct.
As we can see there is no result and that’s what is being told by an error message.
I was able to find two ways to fix the issue:
- Register the resource type manually using below PowerShell.
Add-ClusterResourceType -Name "SQL Server Availability Group" -DisplayName "SQL Server Availability Group" -Dll "C:\Windows\System32\hadrres.dll"
- The better way is: Disable and Enable the feature using SQL Server Configuration Manager. That is what has been told in error message as well.
Now, if we run the same command as earlier, we should see the output
Have you encountered the same error? What was the cause of it?
Reference: Pinal Dave (https://blog.sqlauthority.com)