sp_add_log_shipping_alert_job (Transact-SQL)sp_add_log_shipping_alert_job (Transact-SQL)

适用于: 是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: YesSQL Server NoAzure SQL Database NoAzure Synapse Analytics (SQL DW) NoParallel Data Warehouse

此存储过程用于检查是否已在此服务器上创建了警报作业。This stored procedure checks to see if an alert job has been created on this server. 如果警报作业不存在,则此存储过程将创建警报作业,并将其作业 ID 添加到log_shipping_monitor_alert表。If an alert job does not exist, this stored procedure creates the alert job and adds its job ID to the log_shipping_monitor_alert table. 默认情况下,将启用警报作业并按计划每两分钟运行一次。The alert job is enabled by default and runs on a schedule of once every two minutes.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_add_log_shipping_alert_job  
[, [ @alert_job_id = ] alert_job_id OUTPUT ]  

参数Arguments

[ @alert_job_id = ] alert_job_id OUTPUTMicrosoftMicrosoft SQL ServerSQL Server日志传送警报作业的代理作业 ID。[ @alert_job_id = ] alert_job_id OUTPUT The MicrosoftMicrosoft SQL ServerSQL Server Agent job ID of the log shipping alert job.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

结果集Result Sets

None

备注Remarks

必须从监视服务器上的master数据库运行sp_add_log_shipping_alert_jobsp_add_log_shipping_alert_job must be run from the master database on the monitor server.

权限Permissions

只有sysadmin固定服务器角色的成员才能运行此过程。Only members of the sysadmin fixed server role can run this procedure.

示例Examples

此示例演示如何执行sp_add_log_shipping_alert_job来创建警报作业 ID。This example shows the execution of sp_add_log_shipping_alert_job to create an alert job ID.

USE master  
GO  
EXEC sp_add_log_shipping_alert_job;  

另请参阅See Also

关于日志传送 (SQL Server) About Log Shipping (SQL Server)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)