Error: Unable to Fetch Database in MSSQL Always-On Cluster

Overview

In certain situations, an MSSQL Always-ON cluster fails on creation time. This article provides information and the steps required to resolve the cluster fails and recreate the cluster creation as expected.

Affected Versions

  • ScaleArc all versions, MSSQL cluster with Always-ON

Root Cause

  • Deleted or orphaned entries in an internal MSSQL table holding Always-ON cluster configuration.

Resolution

Verify that the entries on the corresponding cluster to be created are present.

  • It is possible that the AWO cluster corresponding to the listener is not reflecting the entries in sys.dm_hadr_instance_node_map corresponding to your cluster.
  • This is due to deleted AGs (Availability Groups) listing on the registry.
  • ScaleArc runs several queries against the VNN server to discover the configuration options for AGswithin the Always-On setup.
  • One of these queries is:
    SELECT *
    FROM sys.dm_hadr_instance_node_map;
  • This query can have an empty result set if there are any deleted Availability Groups listing within the registry on the server that is currently running the VNN.

    NOTE: Although all members of the AG should be checked for the same registry entry.

Clear the registry by following the steps below to solve this:

  1. Launch regedit on the SQL Server.
  2. Browse to HKEY_LOCAL_MACHINE\CLUSTER\HadrAgNameToldMap
  3. Backup the registry key.
  4. Remove any deleted records.
  5. Verify that running the query results for the ag_resource_id corresponding to the AG_D365C01 cluster.
    SELECT *
    FROM sys.dm_hadr_instance_node_map;

    returns for example

    SELECT *
    FROM sys.dm_hadr_instance_node_map
    WHERE ag_resource_id ='be697968-d6ef-4fe6-a9e3-4c278c8bea4c';
  6. If rows returned exceed 0, recreate the cluster within ScaleArc.

Validation

Recreate the Always-ON cluster, it will succeed fetching the database information and it will allow you to finish the cluster creation as expected.

Comments

0 comments

Article is closed for comments.