Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

How to receive Deadlock information automatically via email. Expand / Collapse
Author
Message
Posted Wednesday, January 5, 2011 4:48 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 10:45 PM
Points: 402, Visits: 935
I just tried that and also added the service account to the DatabaseMailUserProfile role in the msdb and that didnt make any difference either
Post #1043416
Posted Wednesday, January 5, 2011 5:15 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 10:45 PM
Points: 402, Visits: 935
Eureka! So I finally solved the issue - just by trail and error.

When I set the 'Run as user' to 'dbo' in the Job Step it runs without an error.

I can't explain why - but it works!
Post #1043424
Posted Wednesday, January 5, 2011 5:24 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 6:08 AM
Points: 514, Visits: 1,735
Great.

Now let's hope you never actually get the email.
Post #1043426
Posted Thursday, January 6, 2011 9:36 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 10:45 PM
Points: 402, Visits: 935
It's triggered 3 times in the past 24 hours on our production server
Post #1044122
Posted Thursday, February 10, 2011 11:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 19, 2013 12:11 PM
Points: 8, Visits: 250
I am getting two different messages from this procedure. If I run the job I get this error, " Incorrect syntax near '%'. [SQLSTATE 42000] (Error 102)."

If I run the select statement in a query window, I get this one, "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS".

Here is the query from the job that is flagging these errrors:
@query = 'select logdate, procInfo, ERRORLOG from tempdb.dbo.ErrorLog where Id >= (select TOP 1 Id from tempdb.dbo.ErrorLog WHERE ERRORLOG Like ''%Deadlock encountered%'' order by Id DESC)',

I am running this on SQL2005.

Any ideas?
Post #1062205
Posted Monday, September 19, 2011 9:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 25, 2013 4:16 PM
Points: 2, Visits: 17
Geoff, I implemented this and I receive the e-mails but the attachments always contain no data other than columns headers (sample below). Any idea what I might be doing wrong?

Thanks, Steve

logdate procInfo ERRORLOG
----------------------- ---------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(0 rows affected)
Post #1177323
Posted Thursday, July 12, 2012 4:45 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:01 AM
Points: 123, Visits: 462
u need to add (deadlock-list) in ----> Like ''''%Deadlock encountered%''''
in the below query.
@query = ''select logdate, procInfo, ERRORLOG from tempdb.dbo.ErrorLog where Id >= (select TOP 1 Id from tempdb.dbo.ErrorLog WHERE ERRORLOG Like ''''%Deadlock encountered%'''' order by Id DESC)'',

the correct query -
@query = ''select logdate, procInfo, ERRORLOG from tempdb.dbo.ErrorLog where Id >= (select TOP 1 Id from tempdb.dbo.ErrorLog WHERE ERRORLOG Like ''''%deadlock-list%'''' order by Id DESC)'',

the reason behind this is the deadlock grap is not on in your production server .
Post #1328789
Posted Friday, September 21, 2012 4:02 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, February 5, 2013 8:01 AM
Points: 107, Visits: 220
Will performance be affected by a significant amount by utilising this job? Thanks
Post #1362516
Posted Friday, September 21, 2012 6:33 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, June 23, 2014 6:49 AM
Points: 62, Visits: 326
Only one thin Alert notifier=> response =>Excute job which job is selected...
Post #1362609
Posted Friday, September 21, 2012 7:01 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, November 3, 2012 8:04 PM
Points: 37, Visits: 123
Nice post geoff. Does anyone think using DBmail hence getting your sql server to send mails, is a security risk?

At my current place we seems to have .net utility that just sends mail with some parameters where you define osql or sqlcmd commands with the query you use to do any checks.. we seem to use batch files that include all this via scheduled tasks..

we have of course 2005 farm.

What do people think of this approach?
Post #1362633
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse