An email notification is sent when SQL Server Job runs successfully or fails.

Source: Internet
Author: User
Tags management studio sql management studio

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.
5. Finally, do not forget to restart the SQL Agent.

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 from csdn tjvictor column: http://blog.csdn.net/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.