SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


HOW TO FIND the OFFENDING SESSION FROM sys.dm_tran_database transaction


HOW TO FIND the OFFENDING SESSION FROM sys.dm_tran_database transaction

Author
Message
flagamba
flagamba
Grasshopper
Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)

Group: General Forum Members
Points: 16 Visits: 71
Investigating on the use of tempdb with the following very simple query:

select convert(char(15), db_name(database_id)) as dbname
,transaction_id
,database_transaction_begin_time
,database_transaction_log_bytes_used
from sys.dm_tran_database_transactions
where database_transaction_log_bytes_used > 0
[/font]

dbname transaction_id database_transaction_begin_time database_transaction_log_bytes_used
--------------- -------------------- ------------------------------- -----------------------------------
tempdb 4078898703 2013-05-04 17:41:57.570 149539028

I can't find the owner session of transaction #4078898703
But with the following query:

SELECT
session_id
,connect_time
,last_read
,substring(text,1, 18)
FROM sys.dm_exec_connections
CROSS APPLY sys.dm_exec_sql_text (most_recent_sql_handle)
WHERE last_read between '20130504 17:40:00' and '20130504 17:42:00'

87 2013-05-04 17:41:56.170 2013-05-04 17:41:56.207 CREATE Procedure ...

The offending session is #87 (probably)

Why I can't find a reference to transaction #4078898703 in ALL the DMV?
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97861 Visits: 33014
I think this might be posted on Ask.SQLServerCentral too. But you want to use sys.dm_tran_session_transactions. That will let you get transactions for a session or a session for a transaction.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search