473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

select blocking sessions t-sql

Is there a table or structure that contains information that I can see
via the Activity Monitor? I've searched the msdb database and I've not
found any tables that have what I am looking for.
I have tools in Cognos BI that can monitor tables, see changes and
then send email. I want to monitor for blocked processes then react to
them.
We have SQL Server 2005.
TIA
Aug 7 '08 #1
4 6831
rcamarda (ro**************@gmail.com) writes:
Is there a table or structure that contains information that I can see
via the Activity Monitor? I've searched the msdb database and I've not
found any tables that have what I am looking for.
I have tools in Cognos BI that can monitor tables, see changes and
then send email. I want to monitor for blocked processes then react to
them.
We have SQL Server 2005.
You can detect blocking through sys.dm_os_waiting_tasks. For instance
you could poll it once a minute or so, and if wait_duration_ms exceeds
a certain threshold *and* session_id is >= 51 *and* there is a
blocking_session_id <session_id, you could send an alert or whatever.
You probably have to test to see that you don't get too many false alarms.

You may also be interested at looking at my beta_lockinfo,
http://www.sommarskog.se/sqlutil/beta_lockinfo.html.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Aug 7 '08 #2
>
You can detect blocking through sys.dm_os_waiting_tasks. For instance
you could poll it once a minute or so, and if wait_duration_ms exceeds
a certain threshold *and* session_id is >= 51 *and* there is a
blocking_session_id <session_id, you could send an alert or whatever.
You probably have to test to see that you don't get too many false alarms.

You may also be interested at looking at my beta_lockinfo,http://www.sommarskog.se/sqlutil/beta_lockinfo.html.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Thanks Erland, it is perfect for 2005!
Now, I need same thing for SQL Server 2000. As far as I can tell there
sys.dm_os_waiting_tasks doesnt exist in 2000.
Can you help one more time?
(BTW, what key words could I use to search? JOBS and TABLE mostly got
hits on emploment opportunities)
TIA
Aug 8 '08 #3
rcamarda (ro**************@gmail.com) writes:
Thanks Erland, it is perfect for 2005!
Now, I need same thing for SQL Server 2000. As far as I can tell there
sys.dm_os_waiting_tasks doesnt exist in 2000.
Can you help one more time?
The best bet in SQL 2000 is the column master.dbo.sysprocesses.blocked.

My old aba_lockinfo runs on SQL 2000:
http://www.sommarskog.se/sqlutil/aba_lockinfo.html.
(BTW, what key words could I use to search? JOBS and TABLE mostly got
hits on emploment opportunities)
Search for what? I'm pretty bad at searching myself. But if you mean
SQL Server jobs, I guess it helps putting in "Agent". And "SQL Server"
of course.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Aug 8 '08 #4
rcamarda (ro**************@gmail.com) writes:
Is there a table or structure that contains information that I can see
via the Activity Monitor? I've searched the msdb database and I've not
found any tables that have what I am looking for.
I have tools in Cognos BI that can monitor tables, see changes and
then send email. I want to monitor for blocked processes then react to
them.
We have SQL Server 2005.
Also, this blog post from SQL Server MVP Tony Rogerson can be useful:
http://sqlblogcasts.com/blogs/tonyro...e-it-work.aspx

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Aug 10 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marco | last post by:
Hi there ive trying to make a game based on php and currently ive some problems with this part of the script, i've tryed to fix it alone with out success... This is the script <?php...
4
by: Jonathan Fine | last post by:
Hello I have written a program that interacts with a command line program. Roughly speaking, it mimics human interaction. (With more speed and accuracy, less intelligence.) It works fine...
7
by: JP Belanger | last post by:
I have a question on select count(), which may betray my lack of database knowledge. Here goes. I have java code driving a transaction which goes like this: select count(*) from table ...
3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
11
by: Michi Henning | last post by:
Hi, I'm using a blocking Select() call on a socket with a timeout value of -1. I'd expect the call to block indefinitely, but it doesn't. When I use Poll() instead, a timeout of -1 works fine...
7
by: Mr. Mountain | last post by:
In the following code I simulate work being done on different threads by sleeping a couple methods for about 40 ms. However, some of these methods that should finish in about 40 -80 ms take as long...
4
by: Bari | last post by:
Hi all, My problem is: I'm waiting with select() on a socket array, when data is written in one of the sockets the select awakes. The problem is that untill it finishes I can't listen to the...
4
by: pike | last post by:
DB2 UDB 8.1 FP7 We are getting intermittent deadlocks (911 RC 2) even when U row-lock has been secured. The transaction is as follows: 1) Select current application number value from table....
0
by: Maxim Veksler | last post by:
Hi, I'm trying to write a non blocking socket port listener based on poll() because select is limited to 1024 fd. Here is the code, it never gets to "I did not block" until I do a telnet...
10
by: Michele Simionato | last post by:
I have always been curious about how people implement mainloops (or, in Twisted terminology, reactors). So I sit down and I wrote the following simple implementation: import itertools class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.