Skip to content

Commit ccfd7c6

Browse files
[AFTER IGNITE] 20251113 edit pass, add Fabric DW applicability (#35827)
* 20251118 edit pass, add Fabric DW applicability * 20251118 acrolinx * raising acrolinx --------- Co-authored-by: Diana Richards <v-dirichards@microsoft.com>
1 parent 3b8c4e3 commit ccfd7c6

3 files changed

Lines changed: 105 additions & 94 deletions

File tree

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: "sys.dm_tran_active_transactions (Transact-SQL) "
2+
title: "sys.dm_tran_active_transactions (Transact-SQL)"
33
description: sys.dm_tran_active_transactions (Transact-SQL)
44
author: rwestMSFT
55
ms.author: randolphwest
6-
ms.date: "02/27/2023"
6+
ms.date: 11/18/2025
77
ms.service: sql
88
ms.subservice: system-objects
99
ms.topic: "reference"
@@ -18,47 +18,54 @@ helpviewer_keywords:
1818
- "sys.dm_tran_active_transactions dynamic management view"
1919
dev_langs:
2020
- "TSQL"
21-
monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb"
21+
monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric || =fabric-sqldb"
2222
---
2323
# sys.dm_tran_active_transactions (Transact-SQL)
24-
[!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricsqldb](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricsqldb.md)]
2524

26-
Returns information about transactions for the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
27-
28-
> [!NOTE]
29-
> To call this from [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name **sys.dm_pdw_nodes_tran_active_transactions**. [!INCLUDE[synapse-analytics-od-unsupported-syntax](../../includes/synapse-analytics-od-unsupported-syntax.md)]
30-
25+
[!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb.md)]
26+
27+
The `sys.dm_tran_active_transactions` dynamic management view returns information about transactions for the instance.
28+
3129
|Column Name|Data Type|Description|
3230
|-----------------|---------------|-----------------|
33-
|transaction_id|**bigint**|ID of the transaction at the instance level, not the database level. It is only unique across all databases within an instance but not unique across all server instances.|
34-
|name|**nvarchar(32)**|Transaction name. This is overwritten if the transaction is marked and the marked name replaces the transaction name.|
35-
|transaction_begin_time|**datetime**|Time that the transaction started.|
36-
|transaction_type|**int**|Type of transaction.<br /><br /> 1 = Read/write transaction<br /><br /> 2 = Read-only transaction<br /><br /> 3 = System transaction<br /><br /> 4 = Distributed transaction|
37-
|transaction_uow|**uniqueidentifier**|Transaction unit of work (UOW) identifier for distributed transactions. MS DTC uses the UOW identifier to work with the distributed transaction.|
38-
|transaction_state|**int**|0 = The transaction has not been completely initialized yet.<br /><br /> 1 = The transaction has been initialized but has not started.<br /><br /> 2 = The transaction is active.<br /><br /> 3 = The transaction has ended. This is used for read-only transactions.<br /><br /> 4 = The commit process has been initiated on the distributed transaction. This is for distributed transactions only. The distributed transaction is still active but further processing cannot take place.<br /><br /> 5 = The transaction is in a prepared state and waiting resolution.<br /><br /> 6 = The transaction has been committed.<br /><br /> 7 = The transaction is being rolled back.<br /><br /> 8 = The transaction has been rolled back.|
39-
|transaction_status|**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
40-
|transaction_status2|**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
41-
|dtc_state|**int**|**Applies to**: [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] (Initial release through [current release](/previous-versions/azure/ee336279(v=azure.100))).<br /><br /> 1 = ACTIVE<br /><br /> 2 = PREPARED<br /><br /> 3 = COMMITTED<br /><br /> 4 = ABORTED<br /><br /> 5 = RECOVERED|
42-
|dtc_status|**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
43-
|dtc_isolation_level|**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
44-
|filestream_transaction_id|**varbinary(128)**|**Applies to**: [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] (Initial release through [current release](/previous-versions/azure/ee336279(v=azure.100))).<br /><br /> [!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
45-
|pdw_node_id|**int**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]<br /><br /> The identifier for the node that this distribution is on.|
46-
31+
| `transaction_id` |**bigint**|ID of the transaction at the instance level, not the database level. It is only unique across all databases within an instance but not unique across all server instances.|
32+
| `name` |**nvarchar(32)**|Transaction name. This is overwritten if the transaction is marked and the marked name replaces the transaction name.|
33+
| `transaction_begin_time` |**datetime**|Time that the transaction started.|
34+
| `transaction_type` |**int**|Type of transaction.<br /><br /> 1 = Read/write transaction<br /><br /> 2 = Read-only transaction<br /><br /> 3 = System transaction<br /><br /> 4 = Distributed transaction|
35+
| `transaction_uow` |**uniqueidentifier**|Transaction unit of work (UOW) identifier for distributed transactions. The Microsoft distributed transaction coordinator (MS DTC) uses the UOW identifier to work with the distributed transaction.|
36+
| `transaction_state` |**int**|0 = The transaction has not been completely initialized yet.<br /><br /> 1 = The transaction has been initialized but is not started.<br /><br /> 2 = The transaction is active.<br /><br /> 3 = The transaction has ended. Used for read-only transactions.<br /><br /> 4 = The commit process has been initiated on the distributed transaction. For distributed transactions only. The distributed transaction is still active but further processing cannot take place.<br /><br /> 5 = The transaction is in a prepared state and waiting resolution.<br /><br /> 6 = The transaction has been committed.<br /><br /> 7 = The transaction is being rolled back.<br /><br /> 8 = The transaction has been rolled back.|
37+
| `transaction_status` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
38+
| `transaction_status2` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
39+
| `dtc_state` |**int**|**Applies to**: [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)].<br /><br /> 1 = ACTIVE<br /><br /> 2 = PREPARED<br /><br /> 3 = COMMITTED<br /><br /> 4 = ABORTED<br /><br /> 5 = RECOVERED|
40+
| `dtc_status` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
41+
| `dtc_isolation_level` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
42+
| `filestream_transaction_id` |**varbinary(128)**|**Applies to**: [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)].<br /><br /> [!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]|
43+
| `pdw_node_id` |**int**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]<br /><br /> The identifier for the node that this distribution is on.|
44+
4745
## Permissions
4846

4947
On [!INCLUDE[ssNoVersion_md](../../includes/ssnoversion-md.md)] and SQL Managed Instance, requires `VIEW SERVER STATE` permission.
5048

49+
In Microsoft Fabric, membership in the **Contributor** [workspace role](/fabric/fundamentals/roles-workspaces#-workspace-roles) or more privileged role is needed to query `sys.dm_tran_active_transactions`.
50+
5151
On SQL Database **Basic**, **S0**, and **S1** service objectives, and for databases in **elastic pools**, the [server admin](/azure/azure-sql/database/logins-create-manage#existing-logins-and-user-accounts-after-creating-a-new-database) account, the [Microsoft Entra admin](/azure/azure-sql/database/authentication-aad-overview#administrator-structure) account, or membership in the `##MS_ServerStateReader##` [server role](/azure/azure-sql/database/security-server-roles) is required. On all other SQL Database service objectives, either the `VIEW DATABASE STATE` permission on the database, or membership in the `##MS_ServerStateReader##` server role is required.
5252

5353
### Permissions for SQL Server 2022 and later
5454

5555
Requires VIEW SERVER PERFORMANCE STATE permission on the server.
5656

57-
## Examples
58-
59-
### A. Using sys.dm_tran_active_transactions with other DMVs to find information about active transactions
60-
The following example shows any active transactions on the system and provides detailed information about the transaction, the user session, the application that submitted, and the query that started it and many others.
61-
57+
## Remarks
58+
59+
To call this dynamic management view from [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name `sys.dm_pdw_nodes_tran_active_transactions` [!INCLUDE[synapse-analytics-od-unsupported-syntax](../../includes/synapse-analytics-od-unsupported-syntax.md)]
60+
61+
## Examples
62+
63+
<a id="a-using-sysdm_tran_active_transactions-with-other-dmvs-to-find-information-about-active-transactions"></a>
64+
65+
### A. Use sys.dm_tran_active_transactions with other DMVs to find information about active transactions
66+
67+
The following example shows any active transactions on the system. The query provides detailed information about the transaction, the user session, the application that submitted, and the query that started it and many others.
68+
6269
```sql
6370
SELECT
6471
GETDATE() as now,
@@ -76,10 +83,9 @@ ORDER BY
7683
tran_elapsed_time_seconds DESC;
7784
```
7885

86+
## Related content
7987

80-
## See also
81-
[sys.dm_tran_session_transactions &#40;Transact-SQL&#41;](../../relational-databases/system-dynamic-management-views/sys-dm-tran-session-transactions-transact-sql.md)
82-
[sys.dm_tran_database_transactions &#40;Transact-SQL&#41;](../../relational-databases/system-dynamic-management-views/sys-dm-tran-database-transactions-transact-sql.md)
83-
[Dynamic Management Views and Functions &#40;Transact-SQL&#41;](~/relational-databases/system-dynamic-management-views/system-dynamic-management-views.md)
84-
[Transaction Related Dynamic Management Views and Functions &#40;Transact-SQL&#41;](../../relational-databases/system-dynamic-management-views/transaction-related-dynamic-management-views-and-functions-transact-sql.md)
85-
88+
- [sys.dm_tran_session_transactions (Transact-SQL)](sys-dm-tran-session-transactions-transact-sql.md)
89+
- [sys.dm_tran_database_transactions (Transact-SQL)](sys-dm-tran-database-transactions-transact-sql.md)
90+
- [Dynamic Management Views and Functions (Transact-SQL)](~/relational-databases/system-dynamic-management-views/system-dynamic-management-views.md)
91+
- [Transaction Related Dynamic Management Views and Functions (Transact-SQL)](transaction-related-dynamic-management-views-and-functions-transact-sql.md)

0 commit comments

Comments
 (0)