[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

blocked ID

Posted on 2006-10-23
6
Medium Priority
?
312 Views
Last Modified: 2010-08-05
Hi there

How can I create an Alert or any other thing that advise me every time that the server (SQL 2000) get a lock process or any id get blocked by another ID

Thanks
0
Comment
Question by:amedexitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Accepted Solution

by:
Sirees earned 1000 total points
ID: 17789540
How about creating a SP like this and create a new alert with this SP ?

IF (EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'Deadlock Occurance'))
 ---- Delete the alert with the same name.
  EXECUTE msdb.dbo.sp_delete_alert @name = N'Deadlock Occurance'
BEGIN
EXECUTE msdb.dbo.sp_add_alert @name = N'Deadlock Occurance', @message_id = 8901, @severity = 0, @enabled = 1, @delay_between_responses = 60, @include_event_description_in = 5, @job_name = N'Report Problem', @category_name = N'[Uncategorized]'
END
0
 
LVL 9

Expert Comment

by:gpompe
ID: 17789602
You can use something like this (changing the email and names if you want):

USE [msdb]
GO
EXEC msdb.dbo.sp_add_operator @name=N'DBA',
            @enabled=1,
            @pager_days=0,
            @email_address=N'DBA@XXX.com'
GO
EXEC msdb.dbo.sp_add_alert @name=N'Locking',
            @enabled=1,
            @delay_between_responses=0,
            @include_event_description_in=0,
            @performance_condition=N'SQLServer:Locks|Lock Wait Time (ms)|_Total|>|1000',
            @job_id=N'00000000-0000-0000-0000-000000000000'
GO
EXEC msdb.dbo.sp_add_notification @alert_name=N'Locking', @operator_name=N'DBA', @notification_method = 1
GO

0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 17790501
<get a lock process or any id get blocked by another ID
please calrify:
Blocks- or deadlocks?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 43

Assisted Solution

by:Eugene Z
Eugene Z earned 1000 total points
ID: 17790559
for deadlock you can try code below and adjust it to your requirments:

---create operator as per gpompe's post  
use MSDB

IF (EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'deadlock'))
 ---- Delete the alert with the same name.
  EXECUTE msdb.dbo.sp_delete_alert @name = N'deadlock'
BEGIN
EXECUTE msdb.dbo.sp_add_alert @name = N'deadlock', @message_id = 0, @severity = 0, @enabled = 1, @delay_between_responses = 60, @performance_condition = N'SQLServer:Locks|Number of Deadlocks/sec|Database|>|0', @include_event_description_in = 5, @category_name = N'[Uncategorized]'

EXECUTE msdb.dbo.sp_add_notification @alert_name = N'deadlock', @operator_name = N'', @notification_method = 1

END
0
 

Author Comment

by:amedexitt
ID: 17790865
I will say both of them
0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 17791693
Deadlocking is more than blocking. Blocking occurs when one thread is waiting on another, and some brief blocking is normal.

A SQL Server deadlock occurs when two or more processes have acquired locks on their respective resource, and they need to get an incompatible lock on the other's resource in order to finish a transaction. The result is mutual blocking: each waits on the other to acquire some resource that the other process already has.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question