I am writing a small utility to capture Blocking/Blocked processes that is
running for certiain period of time...say 5 sec or more.
logic that I use in the stored proc is (Current Time Stamp -
sysprocesses.Last_Batch) for the duration of the process.
But I am getting incorrect values!!!
Could some one please let me know How to find the Block Duration ?
Thanks
CheriIf you don't want to reinvent the wheel, have a look at
http://www.sommarskog.se/sqlutil/aba_lockinfo.html
Regards
Roji. P. Thomas
http://toponewithties.blogspot.com
"cheri" <cheri@.discussions.microsoft.com> wrote in message
news:026B2B6E-7664-427E-8B06-64058AE12DF7@.microsoft.com...
>I am writing a small utility to capture Blocking/Blocked processes that is
> running for certiain period of time...say 5 sec or more.
> logic that I use in the stored proc is (Current Time Stamp -
> sysprocesses.Last_Batch) for the duration of the process.
> But I am getting incorrect values!!!
> Could some one please let me know How to find the Block Duration ?
> Thanks
> Cheri
>|||cheri (cheri@.discussions.microsoft.com) writes:
> I am writing a small utility to capture Blocking/Blocked processes that is
> running for certiain period of time...say 5 sec or more.
> logic that I use in the stored proc is (Current Time Stamp -
> sysprocesses.Last_Batch) for the duration of the process.
> But I am getting incorrect values!!!
> Could some one please let me know How to find the Block Duration ?
I'm not really sure what you mean with "block duration", but if you mean
how the long the process have been blocked, I don't think this value is
available in SQL 2000.
Current Time Stamp - last_batch will give you completely irrelevant values
for idle processes. For running processes, it only tells you how they
have been running the batch, but not for how long they have been blocked.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Thanks Erland !!!
I am looking for 2 thing..
1. Since How long a process is Blocking another process?
2. Since how long a process is blocked...
Any way I can find the same?
"Erland Sommarskog" wrote:
> cheri (cheri@.discussions.microsoft.com) writes:
> I'm not really sure what you mean with "block duration", but if you mean
> how the long the process have been blocked, I don't think this value is
> available in SQL 2000.
> Current Time Stamp - last_batch will give you completely irrelevant values
> for idle processes. For running processes, it only tells you how they
> have been running the batch, but not for how long they have been blocked.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>|||Cheri
You can look at waittime in sysprocesses to see how long a process has been
blocked. Look at waittype to see if the waiting is because of a lock.
--
HTH
Kalen Delaney, SQL Server MVP
"cheri" <cheri@.discussions.microsoft.com> wrote in message
news:B9A14CB8-5637-400D-B76C-6DDC0F9C69B9@.microsoft.com...
> Thanks Erland !!!
> I am looking for 2 thing..
> 1. Since How long a process is Blocking another process?
> 2. Since how long a process is blocked...
> Any way I can find the same?
>
> "Erland Sommarskog" wrote:
>
Showing posts with label period. Show all posts
Showing posts with label period. Show all posts
Wednesday, March 7, 2012
Friday, February 10, 2012
bit column behavior MSSQL7 and MSSQL2000
I was using MSSQL7 for a long period.
I upsized to MSSQL7 from Access some years ago. Without any particular reason when writing code in stored procedures, when I wanred to select some records having a bit column to true I used the syntax bitcolumn=-1 (and not bitcolumn=1). This behavior was used in Access. Everything worked fine. Then I moved to MSSQL2000 and by restoring the MSSQL7 database I had no problem.
However, in order to use some features of MSSQL2000 I had to run the sp
sp_dbcmptlevel <database>, 80
After that the condition bitcolumn=-1 didn't work.
Can anyone verify this behavior, since I have to make dozens of changes in my stored procedures and triggers?
Regards,
Manolis PerrakisBit datatype stored only value 1, 0, or Null.
Because you cannot use aggregate functions on bit values, sometimes it is preferable to use the tinyint data type instead.|||sp_dbcmptlevel <database>, 80
the sp set the compatibility of the database to 80 (sql server 2k). now the database is on 2k version, where in sql server 2k version the value of bit datatype is 1, 0, or null. so change the syntax bitcolumn=-1 into bitcolumn=1 to refer to "yes"
I upsized to MSSQL7 from Access some years ago. Without any particular reason when writing code in stored procedures, when I wanred to select some records having a bit column to true I used the syntax bitcolumn=-1 (and not bitcolumn=1). This behavior was used in Access. Everything worked fine. Then I moved to MSSQL2000 and by restoring the MSSQL7 database I had no problem.
However, in order to use some features of MSSQL2000 I had to run the sp
sp_dbcmptlevel <database>, 80
After that the condition bitcolumn=-1 didn't work.
Can anyone verify this behavior, since I have to make dozens of changes in my stored procedures and triggers?
Regards,
Manolis PerrakisBit datatype stored only value 1, 0, or Null.
Because you cannot use aggregate functions on bit values, sometimes it is preferable to use the tinyint data type instead.|||sp_dbcmptlevel <database>, 80
the sp set the compatibility of the database to 80 (sql server 2k). now the database is on 2k version, where in sql server 2k version the value of bit datatype is 1, 0, or null. so change the syntax bitcolumn=-1 into bitcolumn=1 to refer to "yes"
Subscribe to:
Posts (Atom)