SQL Server, How to find which table is locked from the SSMS's Activity Monitor

Hi Guys,
Welcome back!

First of all thank you for the many visits to my blog: I am really proud of it
Moreover more than 3.5K friend passionate are awesome!!!

Today in this short post, i will show you a little supertips:
Find the table involved in a lock from the Activity Monitor.

 

Ready? Let'go!


Launch the Activity Monitor from the SSMS.


From the Activity monitor you can for instance observe SPID locked!


You can certainly view the T-SQL command involded!
But amongst the many tables used in our Query, what is the table involved?

Well pretty Easy!
Identify a row in the grid process marked as suspened and watch at the waiting resource column.
Now identify the value of the keylock hobtid property.


 
Finally insert this value in the query below:
       
SELECT o.name, p.*

FROM sys.partitions p

INNER JOIN sys.objects o ON p.object_id = o.object_id WHERE p.hobt_id like '7206088044%608'


Executing this query you will have this result where then name field is the table involved in the lock.



That'all for today!

I hope to see you again very soon!!!
Luca


SQL: READY TO RUN FASTER?













Comments

I Post più popolari

SQL Server, execution plan and the lazy spool (clearly explained)

SQL Server, datetime vs. datetime2

La clausola NOLOCK. Approfondiamo e facciamo chiarezza!