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: