Creating Operators for Alerts and Jobs
Scenarios
You can use a stored procedure to create an operator (notification recipient) for use with alerts and jobs.
Prerequisites
An RDS for SQL Server DB instance has been connected. Connect to the DB instance through the SQL Server client. For details, see Connecting to a DB Instance Through a Public Network.
Procedure
Run the following commands to create an operator for alerts and jobs:
EXEC [msdb].[dbo].[rds_add_operator]
@name ='name',
@enabled=enabled,
@email_address='email_address',
@pager_address='pager_address',
@weekday_pager_start_time= weekday_pager_start_time,
@weekday_pager_end_time= weekday_pager_end_time,
@saturday_pager_start_time= saturday_pager_start_time,
@saturday_pager_end_time= saturday_pager_end_time,
@sunday_pager_start_time= sunday_pager_start_time,
@sunday_pager_end_time= sunday_pager_end_time,
@pager_days= pager_days,
@netsend_address='netsend_address',
@category_name='category';
Parameter |
Description |
---|---|
'name' |
The name of an operator (notification recipient). This name must be unique and cannot contain the percent (%) character. name is sysname, with no default. |
enabled |
The current status of the operator. enabled is tinyint, with a default of 1 (enabled). If the value is 0, the operator is not enabled and does not receive notifications. |
'email_address' |
The e-mail address of the operator. This string is passed directly to the e-mail system. email_address is nvarchar(100), with a default of NULL. |
'pager_address' |
The pager address of the operator. This string is passed directly to the e-mail system. pager_address is nvarchar(100), with a default of NULL. |
weekday_pager_start_time |
The time after which SQL Server Agent sends pager notification to the specified operator on the weekdays, from Monday through Friday. weekday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
weekday_pager_end_time |
The time after which the SQL Server Agent service no longer sends pager notification to the specified operator on the weekdays, from Monday through Friday. weekday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
saturday_pager_start_time |
The time after which the SQL Server Agent service sends pager notification to the specified operator on Saturdays. saturday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
saturday_pager_end_time |
The time after which the SQL Server Agent service no longer sends pager notification to the specified operator on Saturdays. saturday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
sunday_pager_start_time |
The time after which the SQL Server Agent service sends pager notification to the specified operator on Sundays. sunday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
sunday_pager_end_time |
The time after which the SQL Server Agent service no longer sends pager notification to the specified operator on Sundays. sunday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS. |
pager_days |
A number that indicates the days that the operator is available for pages (subject to the specified start/end times). pager_days is tinyint, with a default of 0, indicating the operator is never available to receive a page. Valid values are from 0 through 127. pager_days is calculated by adding the individual values for the required days. For example, from Monday through Friday is 2+4+8+16+32 = 62. The following lists the value for each day of the week:
|
'netsend_address' |
The network address of the operator to whom the network message is sent. netsend_address is nvarchar(100), with a default of NULL. |
'netsend_address' 'category' |
The name of the category for this operator. category is sysname, with a default of NULL. |
After the command is executed, the system displays the following information.
Commands completed successfully.
Example
The command output is as follows.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot