Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

seeing historical blocking and blcoked processes thru DMV

hi,
below query was bringing results 4 hours ago, but now it is not bringing the same records.. can you infer why/what may cause it to fail?
(I am running from master database).

SELECT *
FROM
sys.dm_exec_connections AS Blocking
JOIN
sys.dm_exec_requests AS Blocked
ON
Blocking.session_id = Blocked.blocking_session_id
JOIN sys.dm_os_waiting_tasks
AS Waits  
ON Blocked.session_id = Waits.session_id
RIGHT OUTER JOIN sys.dm_exec_sessions Sess  
ON Blocking.session_id = sess.session_id
CROSS APPLY sys.dm_exec_sql_text(Blocking.most_recent_sql_handle) AS BlockingSQL
CROSS APPLY sys.dm_exec_sql_text(Blocked.sql_handle) AS BlockedSQL
ASKER CERTIFIED SOLUTION
Avatar of Daniel_PL
Daniel_PL
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why an accepted solution receives 100 points and assisted solution 400 points?
Shouldn't be the opposite?
Avatar of 25112
25112

ASKER

I do appreciate the comment, Vitor. I don't say I good at distributing it right. I will take help of mods.

thanks to both experts.
Avatar of 25112

ASKER

thank you again, experts.
thanks to mod also for quick attention!
That's more logical. Thank you.