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)
 Help Understanding SLEEPING Status

Author  Topic 

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2004-07-09 : 11:30:07
I'm trying to write a script to inform me whenever a long-running transaction is detected. I'm only displaying results if open_tran > 0 and spid > 50. I was originally excluding records where status = SLEEPING, but I'm not sure that is correct. As I now understand it (or not) sleeping means the SPID is awaiting a command from the application or is awaiting access to a locked resource. That being said shouldn't I be including records with a status of sleeping since the transaction is still active based upon open_tran > 0?

Also, what does it mean if open_tran > 0, status = sleeping and no locks are held? Is this an indication of a poorly written application due to an incomplete transaction?

Thanks, Dave

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-09 : 12:54:10
Why aren't you using SQL Profiler for this?

Tara
Go to Top of Page

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2004-07-09 : 13:13:00
I thought there would be too much overhead associated with Profiler running every 5 minutes 6:00AM - 6:00PM every day vs. a SQL Job running during the same time period.
Go to Top of Page
   

- Advertisement -