I found many SQL Agent job were enabled but no any notifications setup in case of failure.
I ran the following
use msdb
GO
select * from dbo.sysjobs
where notify_level_email = 0
and enabled = 1
--- gives the list of jobs enabled but no notification set up.
SELECT [ID], [Name], [Enabled]
FROM MSDB.dbo.sysoperators
WHERE [Enabled] = 1
ORDER BY [Name];
Go
-- Gives the list of operators. Pick the Id of the one you want to notify to use in the below script
UPDATE S
SET S.[notify_level_email] = 2,
S.[notify_email_operator_id] = 2 ---my operator
FROM MSDB.dbo.sysjobs S
WHERE S.[Notify_Level_Email] = 0
AND S.[Enabled] = 1;
GO
This blog is created to add all the information and experiences that I have learnt while working on MS sql server as a DBA. The blog is also updated frequently with the real world problem that I encounter hands on at work and the resolutions to resolve them. I hope this blog will be of some use to you and you will revisit. Thank you for stopping by and you are welcome to leave comments.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment