PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > select blocking sessions t-sql
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
select blocking sessions t-sql

Réponse
 
LinkBack Outils de la discussion
Vieux 07/08/2008, 22h10   #1
rcamarda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 07/08/2008, 23h22   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select blocking sessions t-sql

rcamarda (robert.a.camarda@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, esquel@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

  Réponse avec citation
Vieux 08/08/2008, 14h55   #3
rcamarda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select blocking sessions t-sql

>
> 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 one more time?
(BTW, what key words could I use to search? JOBS and TABLE mostly got
hits on emploment opportunities)
TIA
  Réponse avec citation
Vieux 08/08/2008, 23h28   #4
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select blocking sessions t-sql

rcamarda (robert.a.camarda@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 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 s putting in "Agent". And "SQL Server"
of course.

--
Erland Sommarskog, SQL Server MVP, esquel@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

  Réponse avec citation
Vieux 10/08/2008, 20h48   #5
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: select blocking sessions t-sql

rcamarda (robert.a.camarda@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, esquel@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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h27.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11915 seconds with 13 queries