sp_add_operator (Transact-SQL)

Tworzy operator (powiadomienie adresata) do użycia z alertów i zadania.

Topic link iconKonwencje składni języka Transact-SQL

sp_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' ] 

Argumenty

  • [ @name= ] 'name'
    Nazwa operator (adresata powiadomienie).This name must be unique and cannot contain the percent (%) character.name is sysname, with no default.

  • [ @enabled= ] enabled
    Indicates the current status of the operator.enabled is tinyint, with a default of 1 (enabled).Jeśli 0, operator nie jest włączona, a nie otrzyma powiadomienia.

  • [ @email_address= ] 'email_address'
    Adres e-mail operator.This string is passed directly to the e-mail system.email_address is nvarchar(100), with a default of NULL.

    Można określić adres fizyczny wiadomości e-mail lub alias dla email_address. Na przykład:

    "jdoe . "lub"jdoe@xyz.com'

    Uwaga

    E-mail alias można używać tylko w przypadku poczty SQL.Należy użyć adresu e-mail poczta bazy danych.

  • [ @pager_address= ] 'pager_address'
    Adres pager operator.This string is passed directly to the e-mail system.pager_address is narchar(100), with a default of NULL.

  • [ @weekday_pager_start_time= ] 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_timeis 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= ] weekday_pager_end_time
    The time after which SQLServerAgent service no longer sends pager notification to the specified operator on the weekdays, from Monday through Friday.weekday_pager_end_timeis 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 =] saturday_pager_start_time
    The time after which SQLServerAgent 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= ] saturday_pager_end_time
    The time after which SQLServerAgent service no longer sends pager notification to the specified operator on Saturdays.saturday_pager_end_timeis 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= ] sunday_pager_start_time
    The time after which SQLServerAgent service sends pager notification to the specified operator on Sundays.sunday_pager_start_timeis 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 =] sunday_pager_end_time
    The time after which SQLServerAgent service no longer sends pager notification to the specified operator on Sundays.sunday_pager_end_timeis 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= ] pager_days
    Is a number that indicates the days that the operator is available for pages (subject to the specified start/end times).pager_daysis tinyint, with a default of 0 indicating the operator is never available to receive a page.Valid values are from 0 through 127.pager_daysis calculated by adding the individual values for the required days.Na przykład od poniedziałku do piątku jest 2+4+8+16+32 = 62.Poniższa lista zawiera wartości dla każdego dnia tygodnia.

    Wartość

    Description

    1

    Niedziela

    2

    Poniedziałek

    4

    Wtorek

    8

    Środa

    16

    Czwartek

    32

    Piątek

    64

    Sobota

  • [ @netsend_address= ] 'netsend_address'
    The network address of the operator to whom the network message is sent.netsend_addressis nvarchar(100), with a default of NULL.

  • [ @category_name= ] 'category'
    The name of the category for this operator.category is sysname, with a default of NULL.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Zestawy wyników

None

Remarks

sp_add_operator musi być uruchamiane msdb bazy danych.

Stronicowanie jest obsługiwany przez system poczty e-mail, który musi ma możliwość pobierania e-mail-poczty e-mail-do pager, jeśli chcesz użyć stronicowania.

SQL Server Management Studio zapewnia to łatwe, graficzny sposób zarządzania zadaniami i jest zalecanym sposobem tworzenia i zarządzania infrastrukturą zadanie.

Uprawnienia

Tylko członkowie sysadmin roli serwera stałe mogą być wykonać sp_add_operator.

Przykłady

Poniższy przykład przedstawia informacje dotyczące operator dla danwi. Operator jest włączona.SQL Server Agent sends notifications by pager from Monday through Friday from 8 A.M.to 5 P.M.

USE msdb ;
GO

EXEC dbo.sp_add_operator
    @name = N'Dan Wilson',
    @enabled = 1,
    @email_address = N'danwi',
    @pager_address = N'5551290AW@pager.Adventure-Works.com',
    @weekday_pager_start_time = 080000,
    @weekday_pager_end_time = 170000,
    @pager_days = 62 ;
GO