magritton
7/1/2015 - 3:20 PM

SQL Server Always on Availability queries.

SQL Server Always on Availability queries.

--end point state

SELECT state FROM sys.endpoints WHERE name = N'Hadr_endpoint'

SELECT * FROM sys.endpoints

ALTER ENDPOINT [Hadr_endpoint] STATE = STARTED 
--conducted on replica
GRANT CONNECT ON ENDPOINT::[Hadr_endpoint] TO [opwftg\ugritton]
select r.replica_server_name, r.endpoint_url,
rs.connected_state_desc, rs.last_connect_error_description, 
rs.last_connect_error_number, rs.last_connect_error_timestamp 
from sys.dm_hadr_availability_replica_states rs join sys.availability_replicas r
on rs.replica_id=r.replica_id
where rs.is_local=1