View Availability Replica Properties (SQL Server)

Applies to: SQL Server

This topic describes how to view the properties of an availability replica for an Always On availability group by using SQL Server Management Studio or Transact-SQL in SQL Server.

Using SQL Server Management Studio

To view and change properties an availability replica

  1. In Object Explorer, connect to the server instance that hosts the primary replica, and expand the server tree.

  2. Expand the Always On High Availability node and the Availability Groups node.

  3. Expand the availability group to which the availability replica belongs, and expand the Availability Replicas node.

  4. Right-click the availability replica whose properties you want to view, and select the Properties command.

  5. In the Availability Replica Properties dialog box, use the General page to view the properties of this replica. If you are connected to the primary replica, you can change the following properties: availability mode, failover mode, connection access for the primary role, read-access for the secondary role (readable-secondary), and the session-timeout value. For more information, see Availability Replica Properties (General Page).

[!NOTE]

If the cluster type is none, you cannot change the failover mode.

Using Transact-SQL

To view properties and states of availability replicas

To view the properties and states of availability replicas, use the following views and system function:

sys.availability_replicas
Returns a row for every availability replica in each availability group for which the local instance of SQL Server hosts an availability replica.

Column names: replica_id, group_id, replica_metadata_id, replica_server_name, owner_sid, endpoint_url, availability_mode, availability_mode_desc, failover_mode, failover_mode_desc, session_timeout, primary_role_allow_connections, primary_role_allow_connections_desc, secondary_role_allow_connections, secondary_role_allow_connections_desc, create_date, modify_date, backup_priority, read_only_routing_url

sys.availability_read_only_routing_lists
Returns a row for the read only routing list of each availability replica in an Always On availability group in the WSFC failover cluster.

Column names: replica_id, routing_priority, read_only_replica_id

sys.dm_hadr_availability_replica_cluster_nodes
Returns a row for every availability replica (regardless of join state) of the Always On availability groups in the Windows Server Failover Clustering (WSFC) cluster.

Column names: group_name, replica_server_name, node_name

sys.dm_hadr_availability_replica_cluster_states
Returns a row for each replica (regardless of join state) of all Always On availability groups (regardless of replica location) in the Windows Server Failover Clustering (WSFC) cluster.

Column names: replica_id, replica_server_name, group_id, join_state, join_state_desc

sys.dm_hadr_availability_replica_states
Returns a row showing the state of each local availability replica and a row for each remote availability replica in the same availability group.

Column names: replica_id, group_id, is_local, role, role_desc, operational_state, operational_state_desc, connected_state, connected_state_desc, recovery_health, recovery_health_desc, synchronization_health, synchronization_health_desc, last_connect_error_number, last_connect_error_description, and last_connect_error_timestamp

sys.fn_hadr_backup_is_preferred_replica
Determines whether the current replica is the preferred backup replica. Returns 1 if the database on the current server instance is the preferred replica. Otherwise, it returns 0.

Note

For information about performance counters for availability replicas (the SQLServer:Availability Replica performance object), see SQL Server, Availability Replica.

Related Tasks

To view information about availability groups

To manage availability replicas

To manage an availability database

See Also

Overview of Always On Availability Groups (SQL Server)
Monitor Availability Groups (Transact-SQL)
Always On Policies for Operational Issues with Always On Availability Groups (SQL Server)
Administration of an Availability Group (SQL Server)