Skip to content

Commit 520c36a

Browse files
committed
Refresh sys.dm_tcp_listener_states (UUF 499935)
1 parent 86269ae commit 520c36a

1 file changed

Lines changed: 33 additions & 34 deletions

File tree

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: "sys.dm_tcp_listener_states (Transact-SQL)"
3-
description: sys.dm_tcp_listener_states (Transact-SQL)
3+
description: sys.dm_tcp_listener_states returns a row containing dynamic-state information for each TCP listener.
44
author: rwestMSFT
55
ms.author: randolphwest
6-
ms.date: "02/27/2023"
6+
ms.date: 11/03/2025
77
ms.service: sql
88
ms.subservice: system-objects
9-
ms.topic: "reference"
9+
ms.topic: reference
1010
f1_keywords:
1111
- "sys.dm_tcp_listener_states"
1212
- "dm_tcp_listener_states"
@@ -17,38 +17,37 @@ helpviewer_keywords:
1717
- "Availability Groups [SQL Server], listeners"
1818
- "sys.dm_tcp_listener_states dynamic management view"
1919
dev_langs:
20-
- "TSQL"
20+
- TSQL
2121
---
2222
# sys.dm_tcp_listener_states (Transact-SQL)
23+
2324
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
2425

25-
Returns a row containing dynamic-state information for each TCP listener.
26-
27-
> [!NOTE]
28-
> The availability group listener could listen to the same port as the listener of the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. In this case, the listeners are listed separately, the same as for a Service Broker listener.
29-
30-
|Column name|Data type|Description|
31-
|-----------------|---------------|-----------------|
32-
|**listener_id**|**int**|Listener's internal ID. Is not nullable.<br /><br /> Primary key.|
33-
|**ip_address**|**nvarchar(48)**|The listener IP address that is online and currently being listening to. Either IPv4 and IPv6 is allowed. If a listener possesses both types of addresses, they are listed separately. An IPv4 wildcard, is displayed as "0.0.0.0". An IPv6 wildcard, is displayed as "::".<br /><br /> Is not nullable.|
34-
|**is_ipv4**|**bit**|Type of IP address<br /><br /> 1 = IPv4<br /><br /> 0 = IPv6|
35-
|**port**|**int**|The port number on which the listener is listening. Is not nullable.|
36-
|**type**|**tinyint**|Listener type, one of:<br /><br /> 0 = [!INCLUDE[tsql](../../includes/tsql-md.md)]<br /><br /> 1 = Service Broker<br /><br /> 2 = Database mirroring<br /><br /> Is not nullable.|
37-
|**type_desc**|**nvarchar(20)**|Description of the **type**, one of:<br /><br /> TSQL<br /><br /> SERVICE_BROKER<br /><br /> DATABASE_MIRRORING<br /><br /> Is not nullable.|
38-
|**state**|**tinyint**|State of the availability group listener, one of:<br /><br /> 1 = Online. The listener is listening and processing requests.<br /><br /> 2 = Pending restart. the listener is offline, pending a restart.<br /><br /> If the availability group listener is listening to the same port as the server instance, these two listeners always have the same state.<br /><br /> Is not nullable.<br /><br /> Note: The values in this column come from the TSD_listener object. The column does not support an offline state because when the TDS_listener is offline, it cannot be queried for state.|
39-
|**state_desc**|**nvarchar(16)**|Description of **state**, one of:<br /><br /> ONLINE<br /><br /> PENDING_RESTART<br /><br /> Is not nullable.|
40-
|**start_time**|**datetime**|Timestamp indicating when the listener was started. Is not nullable.|
41-
42-
## Permissions
43-
Requires VIEW SERVER STATE permission on the server.
44-
45-
### Permissions for SQL Server 2022 and later
46-
47-
Requires VIEW SERVER SECURITY STATE permission on the server.
48-
49-
## See also
50-
[Querying the SQL Server System Catalog FAQ](../../relational-databases/system-catalog-views/querying-the-sql-server-system-catalog-faq.yml)
51-
[Always On Availability Groups Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/always-on-availability-groups-catalog-views-transact-sql.md)
52-
[Always On Availability Groups Dynamic Management Views and Functions &#40;Transact-SQL&#41;](../../relational-databases/system-dynamic-management-views/always-on-availability-groups-dynamic-management-views-functions.md)
53-
54-
26+
Returns a row containing dynamic-state information for each TCP listener.
27+
28+
> [!NOTE]
29+
> The availability group listener could listen to the same port as the listener of the instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. In this case, the listeners are listed separately, the same as for a Service Broker listener.
30+
31+
| Column name | Data type | Description |
32+
| --- | --- | --- |
33+
| `listener_id` | **int** | Listener's internal ID. Not nullable.<br /><br />Primary key. |
34+
| `ip_address` | **nvarchar(48)** | The listener IP address that's online and currently being listening to. Can be either `IPv4` or `IPv6`. If a listener possesses both types of addresses, they're listed separately. An IPv4 wildcard is displayed as `0.0.0.0`. An IPv6 wildcard is displayed as `::`.<br /><br />Not nullable. |
35+
| `is_ipv4` | **bit** | Type of IP address. One of:<br /><br />`1` = IPv4<br />`0` = IPv6 |
36+
| `port` | **int** | The port number on which the listener is listening. Not nullable. |
37+
| `type` | **tinyint** | Listener type, one of:<br /><br />`0` = [!INCLUDE [tsql](../../includes/tsql-md.md)]<br />`1` = Service Broker<br />`2` = Database mirroring<br /><br />Not nullable. |
38+
| `type_desc` | **nvarchar(20)** | Description of the `type`, one of:<br /><br />`TSQL`<br />`SERVICE_BROKER`<br />`DATABASE_MIRRORING`<br /><br />Not nullable. |
39+
| `state` | **tinyint** | State of the availability group listener, one of:<br /><br />`0` = Online. The listener is listening and processing requests.<br />`1` = Pending restart. the listener is offline, pending a restart.<br /><br />If the availability group listener is listening to the same port as the server instance, these two listeners always have the same state.<br /><br />Not nullable.<br /><br />**Note:** The values in this column come from the `TSD_listener` object. The column doesn't support an offline state because when the `TDS_listener` is offline, it can't be queried for state. |
40+
| `state_desc` | **nvarchar(16)** | Description of `state`, one of:<br /><br />`ONLINE`<br />`PENDING_RESTART`<br /><br />Not nullable. |
41+
| `start_time` | **datetime** | Timestamp indicating when the listener was started. Not nullable. |
42+
43+
## Permissions
44+
45+
[!INCLUDE [sssql19-md](../../includes/sssql19-md.md)] and earlier versions require `VIEW SERVER STATE` permission on the server.
46+
47+
[!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions require `VIEW SERVER SECURITY STATE` permission on the server.
48+
49+
## Related content
50+
51+
- [Querying the SQL Server System Catalog FAQ](../system-catalog-views/querying-the-sql-server-system-catalog-faq.yml)
52+
- [Always On Availability Groups Catalog Views (Transact-SQL)](../system-catalog-views/always-on-availability-groups-catalog-views-transact-sql.md)
53+
- [Always On Availability Groups Dynamic Management Views - Functions](always-on-availability-groups-dynamic-management-views-functions.md)

0 commit comments

Comments
 (0)