DBCC OPENTRAN
DBCC OPENTRAN is a SQL statement in the Transactions category. SQL Server: shows the oldest active transaction in the database. Useful for troubleshooting long-running transactions. The syntax is DBCC OPENTRAN;. It returns active transaction info. A typical example: DBCC OPENTRAN; -- Returns: -- Transaction information for database 'MyDB'. -- Oldest active transaction: -- SPID: 62 -- UID: 1 -- Name: user_transaction -- LSN: (123:456:789) -- Start time: Jun 6 2026 2:30:00 PM -- Kill the blocking transaction: -- KILL 62; -- Check log space: DBCC SQLPERF(LOGSPACE); -- Long-running transactions can cause: -- - Transaction log growth -- - Blocking -- - Stale snapshot reads A close relative is BEGIN / START TRANSACTION, which begins a new transaction. Changes made within are invisible to others until COMMIT. A close relative is COMMIT, which saves all changes made in the current transaction permanently. A close relative is ROLLBACK, which undoes all changes made in the current transaction (or to a savepoint).