{"id":208,"date":"2012-07-27T17:30:57","date_gmt":"2012-07-27T16:30:57","guid":{"rendered":"http:\/\/www.darrencoupland.com\/blog\/?p=208"},"modified":"2012-08-14T14:38:14","modified_gmt":"2012-08-14T13:38:14","slug":"finding-which-operators-are-setup-against-sql-agent-job-notifications","status":"publish","type":"post","link":"https:\/\/www.darrencoupland.com\/blog\/2012\/07\/finding-which-operators-are-setup-against-sql-agent-job-notifications\/","title":{"rendered":"Finding which Operators are setup against SQL Agent Job Notifications"},"content":{"rendered":"<p>As a minimum every SQL Agent Job should have an operator (or DBA) notification setup ideally for failure or completion.<\/p>\n<p><a href=\"http:\/\/www.darrencoupland.com\/blog\/2012\/07\/finding-which-operators-are-setup-against-sql-agent-job-notifications\/agentjobproperties\/\" rel=\"attachment wp-att-216\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-216\" title=\"Agent Job Properties\" src=\"http:\/\/www.darrencoupland.com\/blog\/wp-content\/uploads\/2012\/07\/AgentJobProperties-150x150.jpg\" alt=\"Agent Job Properties\" width=\"150\" height=\"150\" \/><\/a><\/p>\n<p>How do I check which operators are setup against my Agent Jobs I hear you say!<\/p>\n<p>Well run this query below to find out. \u00a0If you have any agent jobs return as &#8216;No email notification configured&#8217; in the\u00a0[Notify_level_email] field\u00a0then an email notification is not setup and you should look into these as a priority (unless you have other methods of monitoring Agent Jobs that is!)<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">SELECT SJ.NAME, SO.[name],SO.[email_address],\r\n[notify_level_email] =\r\nCASE notify_level_email\r\n     WHEN &#039;1&#039; THEN &#039;When the job succeeds&#039;\r\n     WHEN &#039;2&#039; THEN &#039;When the job fails&#039;\r\n     WHEN &#039;3&#039; THEN &#039;When the job completes&#039;\r\n     ELSE &#039;No email notification configured&#039;\r\nEND\r\nFROM\r\nmsdb.dbo.sysjobs SJ LEFT JOIN [msdb].[dbo].[sysoperators] SO \r\nON SJ.notify_email_operator_id = SO.ID\r\nORDER BY SO.ID, SJ.NAME<\/pre>\n<p>Download\u00a0<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"http:\/\/www.darrencoupland.com\/blog\/download\/940\/?tmstv=1777450404\" rel=\"nofollow\" id=\"download-link-940\" data-redirect=\"false\" >\n\tFinding-which-Operators-are-setup-against-SQL-Agent-Job-Notifications\t(5813 downloads\t)\n<\/a>\n<\/p>\n<p>The example below shows the operators setup against Agent Jobs and the email address the notification will be sent to, the first row shows that no operator is setup on this job for email notifications, if this job fails no-one may be aware.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-244\" title=\"Agent Job Notifications\" src=\"http:\/\/www.darrencoupland.com\/blog\/wp-content\/uploads\/2012\/07\/AgentJobNotifications.jpg\" alt=\"Agent Job Notifications\" width=\"636\" height=\"152\" srcset=\"https:\/\/www.darrencoupland.com\/blog\/wp-content\/uploads\/2012\/07\/AgentJobNotifications.jpg 636w, https:\/\/www.darrencoupland.com\/blog\/wp-content\/uploads\/2012\/07\/AgentJobNotifications-300x71.jpg 300w, https:\/\/www.darrencoupland.com\/blog\/wp-content\/uploads\/2012\/07\/AgentJobNotifications-500x119.jpg 500w\" sizes=\"auto, (max-width: 636px) 100vw, 636px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>There&#8217;s a few pre-requisites that your need to ensure are setup first for Agent Email Notifications to work:<br \/>\n1. \u00a0Database Mail should be configured and working (see this great <a href=\"http:\/\/www.sqlservercentral.com\/blogs\/databaseexpertisecom\/2010\/05\/12\/database-mail-set-up-in-sql-server-2008\/\" target=\"_blank\">article<\/a> on SQL Server Central if you don&#8217;t know how to setup Database Mail)<br \/>\n2. \u00a0Agent Operators should be setup with valid email addresses (see my <a href=\"http:\/\/www.darrencoupland.com\/blog\/?p=279\" target=\"_blank\">post<\/a> on recommended operators to setup) <strong><span style=\"color: #ff9900;\">\u00a0<\/span><\/strong><br \/>\n3. \u00a0Agent Jobs should have an email notification configured ideally for &#8216;When jobs the fails&#8217;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>As a minimum every SQL Agent Job should have an operator (or DBA) notification setup ideally for failure or completion.<\/p>\n<p>How do I check which operators are setup against my Agent Jobs I hear you say!<br \/>\nRun the query in this post to find out.<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[29,16,17,60,28],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry","category-sql-server","tag-administration","tag-sql-agent","tag-sql-agent-jobs","tag-sql-server","tag-t-sql"],"_links":{"self":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":0,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}