Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 sql 2000 locks

Author  Topic 

swensor
Starting Member

4 Posts

Posted - 2009-07-29 : 13:30:11
hey all,

i am trying to ascertain what the problem is. basically, i see that there are about 4000 locks on our production database, at any given time, some are as old as 24 hours, and are Lock Type DB, Mode S. They were created by a connection performing a select statement. Why are they still locked? Is this a programmatic error? Also, does this amount of locks slow down my server? They are all being created by an ASP.Net function. Any input would be helpful. Thanks!!

Swensor

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-07-29 : 13:46:23
Does the spid show an open transaction? If it does, then someone/something forgot to commit/rollback.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-07-29 : 13:46:59
And yes locks can slow your system down. For instance, they use resources such as memory and also if anyone wants to modify the data with the shared locks, they'll get blocked from doing it.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

swensor
Starting Member

4 Posts

Posted - 2009-07-29 : 15:07:41
hey,

thanks for your info. so how do i tell if the spid has an open transaction? i know that the simplest select statement for one row of data creates a lock that stays there for quite a while, far after script execution. is there a way to tell (in enterprise manager, or via query?) on a specific spid if it has an open one? thanks again

riley
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-07-29 : 18:37:27
Run select * from master..sysprocess where spid = n to and check the opentran column. 1=opentran, 0=notran.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-07-31 : 14:52:39
DBCC opentran.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-31 : 15:11:10
quote:
Originally posted by swensor

Lock Type DB, Mode S


This is a shared lock so the database cannot be dropped while user is still connected.

All this means is that the user session is still connected. You can kill the spid if it bothers you
Go to Top of Page
   

- Advertisement -