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.
Showing posts with label create sql jobs. move sql jobs. Show all posts
Showing posts with label create sql jobs. move sql jobs. Show all posts
Friday, June 17, 2016
Thursday, November 5, 2015
Work adventure : MoveSQL Agent Jobs to another instanse
It is very easy to move (recreate) the sql agent job that you want to export to another instance of SQL server
- Highlight the job you want o export
- Right click
- Choose Scrip Job as CREATE TO
The script is created and you can run that in the new instance that will create the job.
To move multiple jobs
You can also script multiple jobs to a single file. In SSMS
Click on Jobs,
hit F7 to get the 'Object Explorer Details' tab.
Highlight the jobs you want,
Script job as...
Subscribe to:
Posts (Atom)