Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created May 8, 2024 08:06
Show Gist options
  • Save ghotz/21bd690bd23b2053af54b7ce3542b8bb to your computer and use it in GitHub Desktop.
Save ghotz/21bd690bd23b2053af54b7ce3542b8bb to your computer and use it in GitHub Desktop.
Various Availability Groups metadata queries
SELECT AG1.[name] AS ag_name
, AL1.dns_name AS ag_listener_dns_name
, AL1.[port] AS ag_listener_tcp_port
, AL2.ip_address AS ag_listener_ip_address
, AL2.ip_subnet_mask AS ag_listener_ip_subnet_mask
FROM sys.availability_groups AS AG1
JOIN sys.availability_group_listeners AS AL1
ON AG1.group_id = AL1.group_id
JOIN sys.availability_group_listener_ip_addresses AS AL2
ON AL1.listener_id = AL2.listener_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment