Is there any way to list out the locked tables and to kill the transactions if we want them to be unlocked immediately.
Or is there any other terminology do we need to follow for above operation i am seeking for.
Any Help or guidance will be appreciated.
This will show all databases with exclusive locks being held (which may include transient ones held at the time this is run), using the
sys.dm_tran_locks
DMV:(X = exclusive, S = Shared, IS = Intent Shared) See Lock Modes.
But probably the best way is to turn on Trace Flags 1204 and 1222:
Ref: Detecting and Ending Deadlocks
Also, run
sp_who2
and look for entries in theBlkBy
(Blocked By) column; follow these until you get to the head of the deadlock chain. That is the process identifier (or PID) responsible.To get what sql is running behind a specific process you can run:
and use that PID to kill the Process (with prudence and at your own risk):
Check out Who is Active? v10.00: DMV Monitoring Made Easy
Also read Blocking is not Deadlocking (to distinguish the two scenarios)