?
Solved

Alert Administrators to a blocking condition via email/SMS

Posted on 2004-04-30
4
Medium Priority
?
253 Views
Last Modified: 2010-05-18
Occasionally (once every couple of months) the database we use (MS SQL 2000) suffers from blocking. When a block occurs, manual intervention is often necessary to sort the problem out. The blocks cause huge problems for users of the system until they are cleared.

Does anybody know whether it is possible to create an application/stored procedure etc to check whether blocking exists and send an email and SMS to an administrator?

Any help would be greatly appreciated.

TIA

James
0
Comment
Question by:JamesAStewart
[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
  • 2
4 Comments
 
LVL 6

Expert Comment

by:lausz
ID: 10959756
0
 
LVL 34

Accepted Solution

by:
arbert earned 1500 total points
ID: 10960538
This can be modified for your use:






create table #block (
spid int,
ecid int,
status varchar(255),
loginname varchar(255),
hostname varchar(255),
blocking int,
dbname varchar(255),
command varchar(255)
)

insert into #block
exec sp_who

select * from #block
where blocking>0

if @@rowcount>0
begin
exec   master..xp_sendmail @recipients='archerb',
               @query='sp_who',@attach_results='true',@subject='BLOCKING!!!'

end

drop table #block
0
 
LVL 34

Expert Comment

by:arbert
ID: 10960549
Just schedule the above script to run however often you need it to--every 5minutes or so, it shouldn't use too many resources....
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

743 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