?
Solved

blocked ID

Posted on 2006-10-23
6
Medium Priority
?
307 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

752 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