sp_update_alert(Transact-SQL)

기존 경고의 설정을 업데이트합니다.

항목 링크 아이콘 Transact-SQL 구문 표기 규칙

구문

sp_update_alert 
     [ @name =] 'name' 
     [ , [ @new_name =] 'new_name'] 
     [ , [ @enabled =] enabled] 
     [ , [ @message_id =] message_id] 
     [ , [ @severity =] severity] 
     [ , [ @delay_between_responses =] delay_between_responses] 
     [ , [ @notification_message =] 'notification_message'] 
     [ , [ @include_event_description_in =] include_event_description_in] 
     [ , [ @database_name =] 'database'] 
     [ , [ @event_description_keyword =] 'event_description_keyword'] 
     [ , [ @job_id =] job_id | [@job_name =] 'job_name'] 
     [ , [ @occurrence_count = ] occurrence_count] 
     [ , [ @count_reset_date =] count_reset_date] 
     [ , [ @count_reset_time =] count_reset_time] 
     [ , [ @last_occurrence_date =] last_occurrence_date] 
     [ , [ @last_occurrence_time =] last_occurrence_time] 
     [ , [ @last_response_date =] last_response_date] 
     [ , [ @last_response_time =] last_response _time]
     [ , [ @raise_snmp_trap =] raise_snmp_trap]
     [ , [ @performance_condition =] 'performance_condition' ] 
     [ , [ @category_name =] 'category']
     [ , [ @wmi_namespace = ] 'wmi_namespace' ]
     [ , [ @wmi_query = ] 'wmi_query' ]

인수

  • [ @name =] 'name'
    업데이트할 경고의 이름입니다. name은 sysname이며 기본값은 없습니다.

  • [ @new_name =] 'new_name'
    경고의 새 이름입니다. 이름은 고유해야 합니다. new_name은 sysname이며 기본값은 NULL입니다.

  • [ @enabled =] enabled
    경고를 설정할지(1) 또는 설정하지 않을지(0)를 지정합니다. enabled는 tinyint이며 기본값은 NULL입니다. 경고는 반드시 발생하도록 설정해야 합니다.

  • [ @message_id =] message_id
    경고 정의에 대한 새 메시지 또는 오류 번호입니다. 일반적으로 message_id는 sysmessages 테이블의 오류 번호와 같습니다. message_id는 int이며 기본값은 NULL입니다. 메시지 ID는 경고에 대한 심각도 설정이 0일 때에만 사용할 수 있습니다.

  • [ @severity =] severity
    경고 정의에 대한 새 심각도이며 1에서 25 사이입니다. 지정한 심각도로 Windows 응용 프로그램 로그에 전송된 Microsoft SQL Server 메시지는 경고를 활성화합니다. severity는 int이며 기본값은 NULL입니다. 심각도는 경고에 대한 메시지 ID 설정이 0일 때에만 사용할 수 있습니다.

  • [ @delay_between_responses =] delay_between_responses
    경고에 대한 응답 간의 새로운 대기 기간(초)입니다. delay_between_responses는 int이며 기본값은 NULL입니다.

  • [ @notification_message =] 'notification_message'
    전자 메일, net send 또는 호출기 알림의 일부로 운영자에게 전달되는 추가 메시지의 수정된 텍스트입니다 notification_message는 nvarchar(512)이며 기본값은 NULL입니다.

  • [ @include_event_description_in =] include_event_description_in
    Windows 응용 프로그램 로그에 있는 SQL Server 오류에 대한 설명을 알림 메시지에 포함시킬지 여부를 지정합니다. include_event_description_in은 tinyint이며 기본값은 NULL이고 다음 값 중 하나 이상이 될 수 있습니다.

    설명

    0

    없음

    1

    전자 메일

    2

    호출기

    4

    Net Send

    7

    모두

  • [ @database_name =] 'database'
    해당 오류가 발생해야 경고가 발생되는 데이터베이스의 이름입니다. database는 sysname입니다. 이름을 대괄호([ ])로 묶는 것은 허용되지 않습니다. 기본값은 NULL입니다.

  • [ @event_description_keyword =] 'event_description_keyword'
    오류 메시지 로그에서 오류에 대한 설명에 반드시 있어야 하는 문자 시퀀스입니다. Transact-SQL LIKE 식 패턴 일치 문자를 사용할 수 있습니다. event_description_keyword는 nvarchar(100)이며 기본값은 NULL입니다. 이 매개 변수는 개체 이름(예: %customer_table%)을 필터링하는 데 유용합니다.

  • [ @job_id =] job_id
    작업 ID입니다. job_id는 uniqueidentifier이며 기본값은 NULL입니다. job_id를 지정하는 경우 job_name을 생략해야 합니다.

  • [ @job_name =] 'job_name'
    해당 경고에 대한 응답으로 실행되는 작업의 이름입니다. job_name은 sysname이며 기본값은 NULL입니다. job_name을 지정하는 경우 job_id를 생략해야 합니다.

  • [ @occurrence_count = ] occurrence_count
    경고가 발생한 횟수를 다시 설정합니다. occurrence_count는 int이며 기본값은 NULL이고 0으로만 설정할 수 있습니다.

  • [ @count_reset_date =] count_reset_date
    발생한 횟수가 마지막으로 다시 설정된 날짜를 다시 설정합니다. count_reset_date는 int이며 기본값은 NULL입니다.

  • [ @count_reset_time =] count_reset_time
    발생한 횟수가 마지막으로 다시 설정된 시간을 다시 설정합니다. count_reset_time은 int이며 기본값은 NULL입니다.

  • [ @last_occurrence_date =] last_occurrence_date
    경고가 마지막으로 발생한 날짜를 다시 설정합니다. last_occurrence_date는 int이며 기본값은 NULL이고 0으로만 설정할 수 있습니다.

  • [ @last_occurrence_time =] last_occurrence_time
    경고가 마지막으로 발생한 시간을 다시 설정합니다. last_occurrence_time은 int이며 기본값은 NULL이고 0으로만 설정할 수 있습니다.

  • [ @last_response_date =] last_response_date
    SQLServerAgent 서비스가 경고에 마지막으로 응답한 날짜를 다시 설정합니다. last_response_date는 int이며 기본값은 NULL이고 0으로만 설정할 수 있습니다.

  • [ @last_response_time =] last_response_time
    SQLServerAgent 서비스가 경고에 마지막으로 응답한 시간을 다시 설정합니다. last_response_time은 int이며 기본값은 NULL이고 0으로만 설정할 수 있습니다.

  • [ @raise_snmp_trap =] raise_snmp_trap
    예약되어 있습니다.

  • [ @performance_condition =] 'performance_condition'
    'itemcomparatorvalue' 형식으로 표시된 값입니다. performance_condition은 nvarchar(512)이며 기본값은 NULL이고 다음 요소로 구성됩니다.

    형식 요소

    설명

    Item

    성능 개체, 성능 카운터 또는 카운터의 명명된 인스턴스

    Comparator

    다음 연산자 중 하나: >, <, =

    Value

    카운터의 숫자 값

  • [ @category_name =] 'category'
    경고 범주의 이름입니다. category는 sysname이며 기본값은 NULL입니다.

  • [ @wmi_namespace= ] 'wmi_namespace'
    이벤트를 쿼리하는 WMI 네임스페이스입니다. wmi_namespace는 sysname이며 기본값은 NULL입니다.

  • [ @wmi_query= ] 'wmi_query'
    경고에 대한 WMI 이벤트를 지정하는 쿼리입니다. wmi_query는 nvarchar(512)이며 기본값은 NULL입니다.

반환 코드 값

0(성공) 또는 1(실패)

주의

Microsoft Windows 응용 프로그램 로그에 기록된 sysmessages만 경고를 발생시킬 수 있습니다.

sp_update_alert는 매개 변수 값이 제공되는 경우의 경고 설정만 변경할 수 있습니다. 매개 변수가 생략되면 현재 설정이 보존됩니다.

사용 권한

이 저장 프로시저를 실행하려면 사용자는 sysadmin 고정 서버 역할의 멤버여야 합니다.

다음 예에서는 Test Alert의 enabled 설정을 0으로 변경합니다.

USE msdb ;
GO

EXEC dbo.sp_update_alert
    @name = N'Test Alert',
    @enabled = 0 ;
GO

참고 항목

참조

sp_add_alert(Transact-SQL)

sp_help_alert(Transact-SQL)

시스템 저장 프로시저(Transact-SQL)