Identifying User with Row Locked

  • Is there a way to identify what user has a locked row in a table?

  • You can use the Dynamic Management Views to get a look at the activity in the system. sys.dm_exec_requests will show you active sessions. You'll have the user_id and any existing locks on the system. You can also use sys.dm_tran_locks to see locks taken out by a given transaction. You can combine these two through the session_id. You can also add in other DMVs such as sys.dm_exec_sql_text and sys.dm_exec_query_plan. All these are documented in the Books Online. You could also check out the book "Performance Tuning with SQL Server Dynamic Management Views" by Louis Davidson and Tim Ford.

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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Maybe to follow the idea of Grant , you could have a look at this link :

    It is about the DMV sys.dm_tran_locks

    Maybe also the DMV sys.dm_exec_requests could be useful with the both columns :

    blocking_session_id

    wait_resouce

    see

    The provided links are ( in theory ) covering the 2012/2014 versions of SQL Server.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply