Why You Are Not Able to Access Database in an Availability Group in SQL Server?

Failover Condition Level determines when a failover should occur. This applies to SQL Server Always on Availability Group and to the SQL Server Failover Cluster Instances. Based on the failover condition level, you might not be able to access databases participating in Always On.

Policy to failover

SQL Server Failover Cluster For an availability group, automatic failovers are controlled by failover policy. With these policies, we can attain the highest level of control on the conditions that trigger a failover. In your SQL environment, if users are losing connections to databases in the availability group, you must check and change the failure policy along with the health check frequency.

The table below gives more info about failover conditions

Policy level: 1

Description: The automatic failover occurs when the SQL Server service is down

 

Policy level: 2

Description: The SQL server instance hosting the always on availability group lost connection to the cluster or the timeout threshold specified by the user for health check got exceeded.

 

Policy level: 3

Description: This is the default level for automatic failover. Conditions included in this level are high-level dumping, spinlocks that are orphaned and violations during write-access.

 

Policy level: 4

Description: Conditions included in this level are moderate level server errors. For example, the internal resource pool of a SQL server that meets out of memory state can trigger automatic failover.

 

Policy level: 5

Description: All qualified SQL Server failure conditions contribute to this level.

 

Listeners

Availability group listeners should be online for connections to be successful. You can track the status of listeners using the dynamic management view sys.dm_tcp_listener_states. This view would show following fields for each listener.

1.       ip address
2.       is ipv4
3.       listener id
4.       port
5.       start time
6.       state
7.       state description
8.       type
9.       type description

Feature is Off

After a patch or a reboot, the always on availability group feature might get turned off. If this feature is turned off, always-on groups will not work. You can check the status of this feature using the following code

print cast (SERVERPROPERTY ('IsHadrEnabled') as varchar(10))

If the output is 0, the always on availability group feature is turned off. If it’s 1, the feature is enabled.

Review account permissions

SQL Server Always On Availability GroupAfter a database restore, accounts might have lost permissions on databases that are part of the availability group. Review and restore user accounts and permissions to allow users to connect to always on databases.

Check endpoints

Always-on availability group uses database mirroring endpoints. If these endpoints are not started, or if these endpoints are not listening on correct ports, then you cannot connect to availability groups.

Nonreadable secondary replicas

If secondary replicas in the always-on availability group are configured as nonreadable secondary, then connections cannot access those databases.

With the introduction of SQL Server AlwaysOn, SQL Server recovery has become easy as AlwaysOn supports automatic page repair

Author Introduction:

Neil Varley is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt Outlook and excel recovery software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *