Graphic tutorial on sending email notification when SQLServerJob runs successfully or fails

Source: Internet
Author: User
Tags management studio sql management studio
Although we can use Job logs to check whether SQLServerJob runs successfully or fails, manual queries are neither timely nor intelligent. The following describes how to set up SQLServer mail notifications to automatically send status emails after the Job is completed.

Although we can use Job logs to check whether SQL Server Job runs successfully or fails, manual queries are neither timely nor intelligent. The following describes how to set mail notifications for SQL Server to automatically send status emails after the Job is completed.

The SQL Server 2005 settings are as follows:
1. run SQL Server Surface Area Configuration-> Surface Area Configuration for features-> select Database Mail-> select Enable Database mail stored procedures
2. Choose SQL Management Studio> Management> Database mail> Configure SMTP Settings.
3. enable SQL Server Agent> Operators> to create a new Operator.
4. Create a new Job-> in Notifications, select Email and the newly created Operator-> select to send an Email when the Job fails, succeeds, or completes.

The setting of SQL Server 2008 is the same as that of SQL Server 2005, but there is no first step.

The above brief description is difficult for beginners. The following uses SQL Server 2008 as an example.
1. Choose SQL Management Studio> Management> Database mail> Configure SMTP Settings.
If this is the first configuration, each of the following steps will appear. If the corresponding options have been configured before, the following steps will not all appear.

After configuring the Database Email, send a test mail to test whether the SMTP settings are correct.

2. Choose SQL Server Agent> Operators> Create a new Operator.

3. Create a new Job-> in Notifications, select Email and the newly created Operator-> when the Job fails, succeeds, or completes
Since this section is not a tutorial on specialized jobs, how to create a Job is not shown in this document. The following figure shows how to set Operator.

Never forget to restart the Job Agent.


If you need to reprint, please indicate the original column from CSDN TJVictor:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.