Solved

Alert Administrators to a blocking condition via email/SMS

Posted on 2004-04-30
4
239 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

733 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