Thanks for good script. I needed to log this event to the windows application log so I commented out this part of the script:
--Email the SQL Group a list of jobs running over nn hours -- exec msdb..sp_send_dbmail -- @recipients = @EMailAlertAddress, -- @copy_recipients = @EMailCCAddress, -- @body = @msg, -- @subject = @Subject
--Send errormessage in Windows Application Event log
and added: EXEC master.dbo.xp_logevent 60000, 'Long running job please investigate', error
We don't have the SQL Plugin to HP Operations Manager so I needed to log the event in the Event log so the monitor team can inform me when jobs hang.
|