Failed Task in Maintenance Plan Not Being Reported by Database Mail

  • I have inherited a server on which is a maintenance plan with two subplans on different schedules. In each subplan there are Execute T-SQL tasks with scripts for index rebuilds. Each task is set up with a Completion arrow to the next task and a Failure arrow to a Notify Operator Task. I was asked to add a task for index rebuilds to a specific subplan for a specific database, which is what the other tasks also do. I discovered that my task was failing but the others were fine. No notification was sent about my task failing even though the job is marked in MSDB as a failed job. I have sent a test email using the "Send Test Email..." option when right clicking Database Mail in SSMSand I receive an email so I know Database Mail works.

    I set up a test job to model the index job that I can't get notifications from. I have two T-SQL tasks that just select the top row from a small table. The first task has a syntax error that I did so it would fail. I have a failure arrow to a Notify Operator Task and a Completion arrow to another T-SQL task with no syntax error which has a Success arrow to a Notify Operator task. As expected, when I execute this job I receive one failure email and one success email.

    The only other troubleshooting step I know to try is to add a Notify Operator task before my failing task. That Notify Operator task will hopefully fire to tell me that the previous step was successful. I am not having problems with the other steps so I was just thinking I would try to get the subplan to send me a success email about one of the steps that has been working fine.

    Any other ideas on troubleshooting this?

  • So I have found an error in the SQL Agent Error Logs that is related. "[264] An attempt was made to send an email when not email session has been established. " Most places I look tell me I have to go to SQL Server Agent Properties and enable a mail system and mail profile. Many of them indicate that the SQL Server Agent has to be restarted after this is done, but not all of them indicate this. some indicate this is a bug, but I can't find if it has been resolved. My SQL instance is 2008R2 SP3.

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/839b5c27-9bc5-4467-a9d4-e78f9934a761/264-an-attempt-was-made-to-send-an-email-when-no-email-session-has-been-established?forum=sqltools

    http://www.sqlskills.com/blogs/kimberly/sql-server-2008-fails-to-send-database-mail-sparse-columns-with-filtered-indexes-upcoming-events-and-as-usual-catching-up-i-e-cookies/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply