SQL Server Performance

How can we see all locks ,session name ,session_id

Discussion in 'Getting Started' started by jagpalsingh4, Feb 28, 2008.

  1. jagpalsingh4 New Member

    Hello,
    will somebody plz help me just tell me if i want to see all locks,session name,seesion id with t-sql .How,can we ?
    plz reply
    Thaxxxx..........
  2. Adriaan New Member

    Execute sp_lock ... Read up on it in Books Online.
    In SQL 2005, execute select * from sys.dm_tran_locks
  3. reethu New Member

    you can also see using management studio, under management tree, double click on activity monitor
    and click on locks ny objects or locks by processes
  4. jagpalsingh4 New Member

    Hello,
    But I wish to see lock and sesions and what session are locked
    i know this sp_lock but will u plz tell me how can i see session name and session id .and all locks
  5. jagpalsingh4 New Member

    Hello,
    But I wish to see lock and sesions and what session are locked
    i know this sp_lock but will u plz tell me how can i see session name and session id .and all locks
  6. Adriaan New Member

    Not sure that there is such a thing as a "session name" - there's the SPID that identifies the connection being used by a process.
  7. Arthur Dudnik New Member

  8. jagpalsingh4 New Member

    Hello,
    I have tried aba lockinfo it cant work .will u plz tell me simple query to see all locks and session name and session id that which session are locked .
  9. Adriaan New Member

    If you want to get the T-SQL for what the graphical interface does, just start a trace, then use the interface to get the locking information. Stop the trace, copy the script, and edit to adjust to your liking.
  10. satya Moderator

Share This Page