Thursday, August 18, 2016

Primary Replica of SQL 2014 AlwaysOn Group

q: In SQL Server 2014, what is an easy way to determine which Availability Replica as the Primary Role (meaning they own the cluster at that time)?

a: Here are two options.
' This command, returns all of the data in in sys.availability_replicas table:
Select * from sys.availability_replicas;

' This query returns a single hostname if you're using an automated process to monitor the results.
Select replica_server_name from sys.availability_replicas
where owner_sid is not null;

No comments:

Post a Comment