Database Mail on Maintenance Job Failor

  • How do you setup a maintenace plan to email you when a job fails?

    I've setup Database Mail

    And an Operator...

    Any links or insight would be great... 🙂

  • There are 2 ways:

    1.

    Add a "Notify Operator Task" to your maintenance plan. I like to drag the "failure" constraint from each of the individual tasks to go to the Notify Operator task (using "OR", not "AND") so that I know if any part of the maintenance plan failed. Alternatively, you can create a separate notify operator task for each maintenance component you have in the subplan so that you have greater refinement on what failed.

    2.

    Modify the SQL Agent job, adding the operator to the notifications tab.

    Good Luck!

    Chad

  • Make sure you configure SQL Server Agent to use your DBMail profile (right-click in Object Explorer, properties). And restart SQL Server Agent once you have done so, otherwise it still won't work.



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • One thing I've noticed is that I have no failed circles to drag from. I did create the maintenance plan from the wizard.

  • You only get a success stub off each task, so drag one of the success ones to your task, then double click it and change it to be a failure. If you have multiple paths going to a task, you can indicate whether it should be triggered if all conditions are true (an AND), or any of the conditions are true (an OR) at the same time. Setting AND/OR for one of the paths sets it for all of them (i.e. it's either X or Y or Z, or X and Y and Z, you can't have (X or Y) and Z).

    Good Luck!

    Chad

  • Perfect! Thanks so much

Viewing 6 posts - 1 through 5 (of 5 total)

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