Search code examples
sqlsql-server-2014

How to check active transactions in SQL Server 2014?


I am using SQL Server 2014 and want to know how to check my active transactions?


Solution

    1. Query with sys.sysprocesses

      SELECT * FROM sys.sysprocesses WHERE open_tran = 1
      
    2. DBCC OPENTRAN : helps to identify active transactions that may be preventing log truncation. DBCC OPENTRAN displays information about the oldest active transaction and the oldest distributed and nondistributed replicated transactions, if any, within the transaction log of the specified database. Results are displayed only if there is an active transaction that exists in the log or if the database contains replication information. An informational message is displayed if there are no active transactions in the log.

    3. sys.dm_tran_active_transactions

    Returns information about transactions for the instance of SQL Server. Syntax

    enter image description here

    Wondering about Transaction ?

    A transaction is a single unit of work. If a transaction is successful, all of the data modifications made during the transaction are committed and become a permanent part of the database.

    Find more at docs