Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Determining  Availability Group active/passive nodes in SQL Server 2012

Posted on 2016-11-10
2
39 Views
Last Modified: 2016-11-10
Heyas,

If I have Availability Group setup with 2 nodes, how do I check which node is the active one and which is passive via the GUI?

Also are their SQL queries for this?

Thank you.
0
Comment
Question by:Zack
2 Comments
 
LVL 28

Accepted Solution

by:
Pawan Kumar earned 500 total points
ID: 41883284
Try

SELECT
   AGC.name [AvailabilityGroup],RCS.replica_server_name [SQL cluster node name], ARS.role_desc [Replica Role] , AGL.dns_name [Listener Name]
FROM
 sys.availability_groups_cluster agc INNER JOIN sys.dm_hadr_availability_replica_cluster_states rcs
   ON RCS.group_id = AGC.group_id INNER JOIN sys.dm_hadr_availability_replica_states ars
   ON  ARS.replica_id = RCS.replica_id
  INNER JOIN sys.availability_group_listeners AS AGL
   ON AGL.group_id = ARS.group_id
WHERE
 ARS.role_desc = 'PRIMARY'

Open in new window

0
 

Author Closing Comment

by:Zack
ID: 41883336
Thank you for your help.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question