Identify Oldest Active Transaction with DBCC OPENTRAN

The DBCC OPENTRAN command gives you the information you need by displaying information about the oldest active transaction and the oldest distributed and nondistributed replicated transactions within the specified database.

You can run this against any database and it gives very useful information very quickly.

/*Select the database where you want to check open transactions*/
use History
go

/*Run the below command gets*/
DBCC OPENTRAN

Once it completed successfully, you will get output like below if there is any open trans.

Transaction information for database ‘History’.
Oldest active transaction:
SPID (server process ID): 123———>SPID which is running as oldest active transaction
UID (user ID) : -1
Name : INSERT
LSN : (20564:103684:1)
Start time : Sep 8 2018 9:09:04:597PM———>SPID starts time
SID : 0xdb457fe034824e45aba73e5380ba9d33
Replicated Transaction Information:
Oldest distributed LSN : (20564:103673:1)
Oldest non-distributed LSN : (20564:103674:1)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Happy Learning!

Leave a comment

Your email address will not be published. Required fields are marked *