Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a maintenance plan on my SQL 2008 box - I would like it to send an email address when (or if) it fails. I've set up database mail, and can send a test email..

How can I do this?

share|improve this question

2 Answers 2

up vote 3 down vote accepted
  1. Configure SQL Server Agent to use database mail
  2. Create operator(s) mail, pager, hours, etc.
  3. Configure maintenance plan to email appropriate operator(s) based on exit condition.

http://msdn.microsoft.com/en-us/library/ms186358.aspx

http://technet.microsoft.com/en-us/library/ms175962.aspx

share|improve this answer
    
I've done this... but i can't seem to do number 3...? Where do i find the exit conditions on my tasks? i only have a green arrow coming out of the event box on the designer... –  alex Jan 16 '10 at 2:44
1  
You don't. Edit the SQL Agent job and configure the job to send you an email on job failure. –  mrdenny Jan 16 '10 at 11:08
1  
If you want to be notified per task (when a task fails, rather than when a plan fails), double click on a green arrow to open its properties and change the Value to Failure. You can create multiple arrows ("precedence constraints"?) from a single task, so you can have one which performs the next task upon Completion, and another which sends an email on Failure. If the task fails, the condition for both arrows will be met and both the next task and the email task will be run. –  Dave May 3 '13 at 20:58

Add an Execute SQL task to your maintenance plan that makes the call to sp_send_dbmail and connect the failure routes of any of your other tasks to this task.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.