Setup SQL Server 2008 Maintenance Plan Email Notifications

本文涉及的产品
云数据库 RDS SQL Server,基础系列 2核4GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
简介: 一条龙作完,如何设置EXCHANGE的操作员邮件通知。。 ~~~~ http://808techblog.com/2009/07/setup-sql-server-2008-maintena.html   For most of the SQL installs that I maintai...

一条龙作完,如何设置EXCHANGE的操作员邮件通知。。

~~~~

http://808techblog.com/2009/07/setup-sql-server-2008-maintena.html

 

For most of the SQL installs that I maintain, nightly SQL dumps to disk and then copy to tape is my preferred backup method. I use a simple maintenance plan that dumps all user databases to the local disk and then a cleanup task that purges backup files older than a set number of days. An email alert with either success or fail in the subject line is sent out after each maintenance plan task is completed. This article will review step by step how to add email notifications to your existing SQL 2008 maintenance plan.

First step is to configure Database Mail. Open Microsoft SQL Server Management Studio then right-click on Database Mail > select Configure Database Mail

dbemailconfig.jpg

Skip the welcome screen and select Next on the Select Configuration Task window.

dbmailwizard.jpg

Create new profile > fill out Profile name > Select Add under SMTP accounts:

newprofile.jpg

Fill out New Database Mail Account info:

smtpaccount.jpg

Configure Profile Security > check Public > set as Default > Next > Finish > close

publicprofile.jpg

Send test email. Right-click on Database Mail

dbemailconfigtest.jpg

Fill out test info, select Send Test Email. 

dbmailtest.jpg

Check inbox, select OK on the confirmation screen. If you dont recieve test email then double check and verify smtp settings.

testemailok.jpgNext step is to configure Operators. Under Object Explorer right-click on Operators > New Operator

newoperator.jpg

Fill out New Operator info (minimum name and email address)

sysadminproperties.jpg

Select OK.

sysadmin.jpgNext, right click on designated maintenance plan (assuming one is already configured) and select Modify

 

 

 

dbmaintmodify.jpg

 

 

 

 

 

This should bring up the design window with the current tasks

 

 

 

 

 

 

dbmaintplan.jpg

From the Toolbox window Drag and drop Notify Operator Task to Design window twice. One for success and the other for fail.

generaltools.jpg

Connect the backup database task to each Notify Operator Task and make sure the arrows are pointing down.

dbplanfinal.jpg

Designate one of the Notify Operator Task objects connection arrows as Failure. Right click on connection and select Failure. This will turn the connection arrow red.

connectionset.jpg

Double click each Notify Operator Task > check which operators to notify if there are more than one > fill out Subject and Body fields > select OK

notifyoperatortask.jpgSave Maintenance Plan and test.

successalert.jpgOne of the nice features of the Notify Operator Task in SQL 2008 that wasn't an option in SQL 2005 is the ability to add a unique subject line to the message. Its helpful to be able to see the success or fail status at a glance from just the subject line especially with the morning barrage of emails. Comments or questions welcomed. 

相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情: https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
7月前
|
SQL 分布式计算 大数据
利用SparkSQL Logical Plan Parse 打造大数据平台SQL诊断利器
利用SparkSQL Logical Plan Parse 打造大数据平台SQL诊断利器
108 0
|
SQL 存储 缓存
Oracle-SQL Explain Plan解读
Oracle-SQL Explain Plan解读
175 0
|
SQL 存储 JSON
使用实践:Fixed Plan加速SQL执行
本文将会介绍在Hologres中如何通过fixed plan加速SQL运行
11722 0
使用实践:Fixed Plan加速SQL执行
|
SQL 存储 关系型数据库
|
SQL 存储 数据库
SQL Plan Management介绍
基于成本的优化法则基于统计信息找到最优执行计划,但是一些环境的变化可能影响执行计划的改变如: ·         New optimizer version ·         Changes to optimizer statist...
1051 0