Check open transactions in SQL Server

Check the active transaction in SQL Server

Use the sys.dm_tran_active_transactions DMV to get information about active transactions.

SELECT 
 transaction_id, 
 name, 
 transaction_state, 
 transaction_begin_time, 
 database_id 
FROM sys.dm_tran_active_transactions; 

Using the DBCC OPENTRAN Command

USE YourDatabaseName;
GO
DBCC OPENTRAN;

Using SQL Server Management Studio (SSMS):
o Open SSMS and connect to the SQL Server instance.
o Navigate to the database you want to check.
o Right-click the database, select Reports > Standard Reports > All Transactions

Detailed information about open transactions, including the session and database

SELECT 
 st.transaction_id,
 at.name,
 at.transaction_begin_time,
 st.session_id,
 dt.database_id,
 DB_NAME(dt.database_id) AS DatabaseName
FROM sys.dm_tran_session_transactions st
JOIN sys.dm_tran_active_transactions at ON st.transaction_id = 
at.transaction_id
JOIN sys.dm_tran_database_transactions dt ON dt.transaction_id = 
st.t

Leave a Reply