Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

db locks in my database

Status
Not open for further replies.

eja2000

Programmer
Nov 30, 2003
209
NG
when i run sp_lock on my db , i see lots of DB locks..
how can i get rid of them AND detect which sql statements are causing them?
thx
 
Just a small quote from books online
Microsoft® SQL Server™ 2000 uses locking to ensure transactional integrity and database consistency. Locking prevents users from reading data being changed by other users, and prevents multiple users from changing the same data at the same time. If locking is not used, data within the database may become logically incorrect, and queries executed against that data may produce unexpected results.

Although SQL Server enforces locking automatically, you can design applications that are more efficient by understanding and customizing locking in your applications.

I think you would need to read a bit more about the whole "Locking" subject before you try to remove locks.
Secondly you can use sp_who and sp_who2 to show you what spid is processing and what SQL statement is executing at the time the locks are being taken out.
But my primary advice is to read more before you take any drastic action - alternatively post some more specific questions as there are a lot of knowledgable people who use this forum who could provide you a lot better advice than me.

"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top