When I run this query
SELECT transaction_id, name, transaction_begin_time, transaction_state
FROM sys.dm_tran_active_transactions
I always have these 6 rows in the result set
transaction_id | name | transaction_begin_time | transaction_state |
---|---|---|---|
496 | worktable | 29/10/2024 00:11:56 | 2 |
499 | worktable | 29/10/2024 00:11:56 | 2 |
501 | worktable | 29/10/2024 00:11:56 | 2 |
503 | worktable | 29/10/2024 00:11:56 | 2 |
506 | worktable | 29/10/2024 00:11:56 | 2 |
509 | worktable | 29/10/2024 00:11:56 | 2 |
Is this normal?
And if not, how can I find where they originate from so I can check out what is going on?
Based on the answer from john, I tried this query
SELECT GETDATE() as now,
DATEDIFF(SECOND, transaction_begin_time, GETDATE()) as tran_elapsed_time_seconds,
st.session_id,
txt.text,
at.transaction_id,
at.transaction_begin_time,
at.transaction_type,
at.transaction_status
FROM sys.dm_tran_active_transactions at
left JOIN sys.dm_tran_session_transactions st ON st.transaction_id = at.transaction_id
LEFT OUTER JOIN sys.dm_exec_sessions sess ON st.session_id = sess.session_id
LEFT OUTER JOIN sys.dm_exec_connections conn ON conn.session_id = sess.session_id
OUTER APPLY sys.dm_exec_sql_text(conn.most_recent_sql_handle) AS txt
where at.transaction_id in (496, 499, 501, 503, 506, 509)
ORDER BY
tran_elapsed_time_seconds DESC
and it gives me this result
now | tran_elapsed_time_seconds | session_id | text | transaction_id | transaction_begin_time | transaction_type | transaction_status |
---|---|---|---|---|---|---|---|
26/11/2024 11:01:57 | 2458201 | 496 | 29/10/2024 00:11:56 | 2 | 0 | ||
26/11/2024 11:01:57 | 2458201 | 499 | 29/10/2024 00:11:56 | 2 | 0 | ||
26/11/2024 11:01:57 | 2458201 | 501 | 29/10/2024 00:11:56 | 2 | 0 | ||
26/11/2024 11:01:57 | 2458201 | 503 | 29/10/2024 00:11:56 | 2 | 0 | ||
26/11/2024 11:01:57 | 2458201 | 506 | 29/10/2024 00:11:56 | 2 | 0 | ||
26/11/2024 11:01:57 | 2458201 | 509 | 29/10/2024 00:11:56 | 2 | 0 |
When I use an inner join
for JOIN sys.dm_tran_session_transactions st
I get no rows
at all.
I don't know how or what more information I can give about this, does the information in this question makes sense to anyone here ?
Edit
I installed WhoIsActive (as proposed in a comment) but it returns no rows while these transactions are the only ones, so I have no help there either
sp_WhoIsActive
show?