--- title: "sys.dm_tran_database_transactions (Transact-SQL)" description: "sys.dm_tran_database_transactions returns information about transactions at the database level." author: rwestMSFT ms.author: randolphwest ms.date: 11/18/2025 ms.service: sql ms.subservice: system-objects ms.topic: "reference" ms.custom: - ignite-2025 f1_keywords: - "dm_tran_database_transactions" - "sys.dm_tran_database_transactions_TSQL" - "dm_tran_database_transactions_TSQL" - "sys.dm_tran_database_transactions" helpviewer_keywords: - "sys.dm_tran_database_transactions dynamic management view" dev_langs: - "TSQL" monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric || =fabric-sqldb" --- # sys.dm_tran_database_transactions (Transact-SQL) [!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb.md)] The `sys.dm_tran_database_transactions` dynamic management view returns information about transactions at the database level. |Column name|Data type|Description| |-----------------|---------------|-----------------| | `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.| | `database_id` |**int**|ID of the database associated with the transaction.

In [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], the values are unique within a single database or an elastic pool, but not within a logical server.| | `database_transaction_begin_time` |**datetime**|Time at which the database became involved in the transaction. Specifically, it is the time of the first log record in the database for the transaction.| | `database_transaction_type` |**int**|1 = Read/write transaction

2 = Read-only transaction

3 = System transaction| | `database_transaction_state` |**int**|1 = The transaction has not been initialized.

3 = The transaction has been initialized but has not generated any log records.

4 = The transaction has generated log records.

5 = The transaction has been prepared.

10 = The transaction has been committed.

11 = The transaction has been rolled back.

12 = The transaction is being committed. (The log record is being generated, but is not materialized or persisted.)| | `database_transaction_status` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]| | `database_transaction_status2` |**int**|[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]| | `database_transaction_log_record_count` |**bigint**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of log records generated in the database for the transaction.| | `database_transaction_replicate_record_count` |**int**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of log records generated in the database for the transaction that is replicated.| | `database_transaction_log_bytes_used` |**bigint**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of bytes used so far in the database log for the transaction.| | `database_transaction_log_bytes_reserved` |**bigint**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of bytes reserved for use in the database log for the transaction.| | `database_transaction_log_bytes_used_system` |**int**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of bytes used so far in the database log for system transactions on behalf of the transaction.| | `database_transaction_log_bytes_reserved_system` |**int**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Number of bytes reserved for use in the database log for system transactions on behalf of the transaction.| | `database_transaction_begin_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

Log sequence number (LSN) of the begin record for the transaction in the database log.| | `database_transaction_last_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

LSN of the most recently logged record for the transaction in the database log.| | `database_transaction_most_recent_savepoint_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

LSN of the most recent savepoint for the transaction in the database log.| | `database_transaction_commit_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

LSN of the commit log record for the transaction in the database log.| | `database_transaction_last_rollback_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

LSN that was most recently rolled back to. If no rollback has taken place, the value is MaxLSN.| | `database_transaction_next_undo_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later versions.

LSN of the next record to undo.| | `pdw_node_id` |**int**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]

The identifier for the node that this distribution is on.| | `database_transaction_first_repl_lsn` |**numeric(25,0)**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]

LSN of the first log record in the transaction that needs replication.| ## Permissions On [!INCLUDE[ssNoVersion_md](../../includes/ssnoversion-md.md)] and SQL Managed Instance, requires `VIEW SERVER STATE` permission. 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_database_transactions`. 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. ### Permissions for SQL Server 2022 and later Requires VIEW SERVER PERFORMANCE STATE permission on the server. ## Remarks To call this DMV from [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)], use the name `sys.dm_pdw_nodes_tran_database_transactions` [!INCLUDE[synapse-analytics-od-unsupported-syntax](../../includes/synapse-analytics-od-unsupported-syntax.md)] ## Related content - [sys.dm_tran_active_transactions (Transact-SQL)](sys-dm-tran-active-transactions-transact-sql.md) - [sys.dm_tran_session_transactions (Transact-SQL)](sys-dm-tran-session-transactions-transact-sql.md)