Wednesday, May 20, 2009

Unlock the table in Sql Server 2005

By using SP_Lock you get the info on the locks, I means locks on the objects like Tables. You can also find the SPID (Processor Id) which is locking this.
By using Kill command you can kill the processor which intern releases the locks.
Following is the example:
EXEC sp_lock --> all the objects with the lock info and find the processor locking the required object let us ay spid is 54

or
dbcc opentran
dbcc inputbuffer(yourprocessid)

KILL 54 --> this will kill the processor id 54.
Please make sure that you are killing only the processor which is locking your objects.

No comments: