List of current sessions causing blocking


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SELECT lok.resource_type
  2. ,lok.resource_subtype
  3. ,DB_NAME(lok.resource_database_id)
  4. ,lok.resource_description
  5. ,lok.resource_associated_entity_id
  6. ,lok.resource_lock_partition
  7. ,lok.request_mode
  8. ,lok.request_type
  9. ,lok.request_status
  10. ,lok.request_owner_type
  11. ,lok.request_owner_id
  12. ,lok.lock_owner_address
  13. ,wat.waiting_task_address
  14. ,wat.session_id
  15. ,wat.exec_context_id
  16. ,wat.wait_duration_ms
  17. ,wat.wait_type
  18. ,wat.resource_address
  19. ,wat.blocking_task_address
  20. ,wat.blocking_session_id
  21. ,wat.blocking_exec_context_id
  22. ,wat.resource_description
  23. FROM sys.dm_tran_locks lok
  24. JOIN sys.dm_os_waiting_tasks wat
  25. ON lok.lock_owner_address = wat.resource_address

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.