Register   |  Login
You are hereHome
 Article Details
Finding locks on a Table

We are working on an application and which had got login screen as an entry page. One day all the developers were getting time out error from the development database when they launch the application.

Ok fine. But we were able to connect to the Sql server without any issues. So Server availability was not an issue. We were able to query all the tables without any issue except the UserInfo table. UserInfo was the table which had got user credentials.

The select statement took so much of time and received time out error after some time.

There was a lock applied on the table and which was not released.

Ok. Now let’s see the solution for this problem.

 

Finding locks and Killing unwanted on the tables

Get the id of the object UserInfo by using the following statement

SELECT OBJECT_ID('UserInfo') –Gets id of the object UserInfo

 

Find the applied locks on the object UserInfo

sp_lock 2105058535 -- 2105058535 ID of the object UserInfo

 

Now we need to find out the sleeping processes or unwanted processes which have applied locks on the table object UserInfo

kill 52 --52 is the process id

That’s it this resumed our development work J.

I hope you may find this useful.


Written By: Kumaravel
Date Posted: 2/18/2009
Number of Views: 467


Comments
You must be logged in to submit a comment.

Return