In this post, I provide you one SQL script to find out all open transaction in SQL Server.
This script is very helpful to all level of SQL DBA.
There are many way to find open transactions in SQL Server.
Here, I used sys.dm_tran_database_transactions view to find out open transactions.
For more details you can also visit this Microsoft URL:
Please use this script to find list of open transactions:
WHEN 1 THEN 'Read/write transaction'
WHEN 2 THEN 'Read only transaction'
WHEN 3 THEN 'System transaction'
WHEN 1 THEN 'Transaction not initialized'
WHEN 3 THEN 'Transaction has not generated by any log'
WHEN 4 THEN 'Transaction has generated by log'
WHEN 5 THEN 'Transaction Prepared'
WHEN 10 THEN 'Transaction Committed'
WHEN 11 THEN 'Transaction Rolled back'
WHEN 12 THEN 'Transaction committed and log generated'
FROM sys.dm_tran_database_transactions tdt
INNER JOIN sys.dm_tran_session_transactions tst
ON tst.transaction_id = tdt.transaction_id
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.