Updated on 2024-10-14 GMT+08:00

Updating Information About Operators for Alerts and Jobs

Scenarios

You can use a stored procedure to update information about 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 update information about the operator for the alert and job:

EXEC [msdb].[dbo].[rds_update_operator]

@name ='name',

@new_name = 'new_name',

@enabled=enabled,

@email_address='email_address',

@pager_address= 'pager_number',

@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';

Table 1 Parameter description

Parameter

Description

'name'

The name of the operator to modify. This name must be unique and cannot contain the percent (%) character. name is sysname, with no default.

'new_name'

The new name for the operator. This name must be unique. new_name is sysname, with a default of NULL.

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_number'

The pager address of the operator. This string is passed directly to the e-mail system. pager_number 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:

  • 1: indicates Sunday.
  • 2: indicates Monday.
  • 4: indicates Tuesday.
  • 8: indicates Wednesday.
  • 16: indicates Thursday.
  • 32: indicates Friday.
  • 64: indicates Saturday.

'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.

'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.