5

My SQL Server 2008 started hanging on simple queries, so I checked for blocking transactions, using the built-in All Blocking Transactions report. Sure enough, such a transaction exists. However, if I expand Blocking SQL Statement, I get a blank box. How can I find out more about the problem?

This transaction is blocking several jobs which are business-critical (well, not really, but the boss and the boss's boss depend on them), so I reluctantly KILLed the blocking session. 20 minutes later, it's still "rolback in progress... completion: 0%... estimated time remaining: 0 seconds." I'd really like to know what's causing this, I haven't had a single noticeable block for several months.

  • 1
    We've seen the same recently... in our case the blocking statement is listed as "--" in the blocking transactions report as well as DBCC INPUTBUFFER (spid). Still trying to figure out how this is posisble. It's a third-part application, and I suspect a transaction nesting issue, but the app-layer code is closed to us and what we can see at the DB layer is a spaghetti mess. – rmalayter Dec 05 '12 at 20:09

2 Answers2

4

What version of SQL are you on? If 2005 and above, try to identify the offending query using below script? [Disclaimer: I am not the original author of the script; i had it in my library for a while but i couldn't give proper credit for the original author since i couldnt remember where i get it]

SELECT
db.name DBName,
tl.request_session_id,
wt.blocking_session_id,
OBJECT_NAME(p.OBJECT_ID) BlockedObjectName,
tl.resource_type,
h1.TEXT AS RequestingText,
h2.TEXT AS BlockingTest,
tl.request_mode
FROM sys.dm_tran_locks AS tl
INNER JOIN sys.databases db ON db.database_id = tl.resource_database_id
INNER JOIN sys.dm_os_waiting_tasks AS wt ON tl.lock_owner_address = wt.resource_address
INNER JOIN sys.partitions AS p ON p.hobt_id = tl.resource_associated_entity_id
INNER JOIN sys.dm_exec_connections ec1 ON ec1.session_id = tl.request_session_id
INNER JOIN sys.dm_exec_connections ec2 ON ec2.session_id = wt.blocking_session_id
CROSS APPLY sys.dm_exec_sql_text(ec1.most_recent_sql_handle) AS h1
CROSS APPLY sys.dm_exec_sql_text(ec2.most_recent_sql_handle) AS h2
GO
DaniSQL
  • 1,097
  • 7
  • 12
  • 1
    I had to comment out the join on `sys.partitions` and the corresponding `OBJECT_NAME(…)` to display rows. – Michael Jul 16 '20 at 14:45
0

try with sp_who2
you can observe what is going on your db