Transact-SQL 参考

sp_update_log_shipping_monitor_info

更新关于日志传送对的监视信息。

语法

sp_update_log_shipping_monitor_info
    [@primary_server_name =] 'primary_server_name'
    [@primary_database_name =] 'primary_database_name'
    [@secondary_server_name =] 'secondary_server_name'
    [@secondary_database_name =] 'secondary_database_name'
    [,[@backup_threshold =] backup_threshold]
    [,[@backup_threshold_alert =] backup_threshold_alert]
    [,[@backup_threshold_alert_enabled =] backup_threshold_alert_enabled]
    [,[@backup_outage_start_time =] backup_outage_start_time]
    [,[@backup_outage_end_time =] backup_outage_end_time]
    [,[@backup_outage_weekday_mask =] backup_outage_weekday_mask]
    [,[@copy_enabled =] copy_enabled]
    [,[@load_enabled =] load_enabled]
    [,[@out_of_sync_threshold =] out_of_sync_threshold]
    [,[@out_of_sync_threshold_alert =] out_of_sync_threshold_alert]
    [,[@out_of_sync_threshold_alert_enabled =] out_of_sync_threshold_alert_enabled]
    [,[@out_of_sync_outage_start_time =]out_of_sync_outage_start_time]
    [,[@out_of_sync_outage_end_time =] out_of_sync_outage_end_time]
    [,[@out_of_sync_outage_weekday_mask =] out_of_sync_outage_weekday_mask]

参数

[@primary_server_name =] 'primary_server_name'

主服务器名称。primary_server_name 的数据类型为 sysname,没有默认值。

[@primary_database_name =] 'primary_database_name'

主服务器上的数据库名称。primary_database_name 的数据类型为 sysname,没有默认值。

[@secondary_server_name =] 'secondary_server_name'

第二台服务器的名称。secondary_server_name 的数据类型为 sysname,没有默认值。

[@secondary_database_name =] 'secondary_database_name'

是辅助服务器上的数据库名称。secondary_database_name 的数据类型为 sysname,无默认值。

[@backup_threshold =] backup_threshold

是从上一次备份之后,至引发阈值警报错误之前的时间长度(以分钟计)。backup_threshold 的数据类型为 int,其默认值为 NULL。

[@backup_threshold_alert =] backup_threshold_alert

是超出备份阈值时引发的错误。backup_threshold_alert 的数据类型为 int,其默认值为 NULL。

[@backup_threshold_alert_enabled =] backup_threshold_alert_enabled

指定当超出 backup_threshold 值时是否发出警报。数字 1 表示将引发警报。backup_threshold_alert_enabled 的数据类型为 bit,其默认值为 NULL。

[@backup_outage_start_time =] backup_outage_start_time

是计划停歇开始的时间,以 HHMMSS 格式表示。在计划停歇期间,超出备份阈值时不会引发警报。backup_outage_start_time 的数据类型为 int,其默认值为 NULL。

[@backup_outage_end_time =] backup_outage_end_time

是计划停歇终止的时间,以 HHMMSS 格式表示。backup_outage_end_time 的数据类型为 int,其默认值为 NULL。

[@backup_outage_weekday_mask =] backup_outage_weekday_mask

表示计划停歇发生在一周中的哪一天。backup_outage_weekday_mask 的数据类型为 int,其默认值为 NULL。它可以是下列值中的一个或多个。

1 星期日
2 星期一
4 星期二
8 星期三
16 星期四
32 星期五
64 星期六

[@copy_enabled =] copy_enabled

指定是否在第二台服务器上启用数据库的副本。数值 1 表明启用复制。copy_enabled 的数据类型为 bit,其默认值为 NULL。

[@load_enabled =] load_enabled

指定是否在辅助服务器上启用数据库装载。load_enabled 的数据类型为 bit,其默认值为 NULL。

[@out_of_sync_threshold =] out_of_sync_threshold

是从上一次装载之后至引发错误之前的时间长度(以分钟计)。out_of_sync_threshold 的数据类型为 int,其默认值为 NULL。

[@out_of_sync_threshold_alert =] out_of_sync_threshold_alert

是超出不同步阈值时引发的错误。out_of_sync_threshold_alert 的数据类型为 int,其默认值为 NULL。

[@out_of_sync_threshold_alert_enabled =] out_of_sync_threshold_alert_enabled

指定当超出不同步阈值时是否引发警报。数值 1 表明将引发警报。out_of_sync_threshold_alert_enabled 的数据类型为 bit,其默认值为 NULL。

[@out_of_sync_outage_start_time =] out_of_sync_outage_start_time

是计划停歇开始的时间,以 HHMMSS 格式表示。在计划停歇期间,超出不同步阈值不会引发警报。out_of_sync_outage_start_time 的数据类型为 int,其默认值为 NULL。

[@out_of_sync_outage_end_time =] out_of_sync_outage_end_time

是计划停歇终止的时间,以 HHMMSS 格式表示。out_of_sync_outage_end_time 的数据类型为 int型,其默认值为 NULL。

[@out_of_sync_outage_weekday_mask =] out_of_sync_outage_weekday_mask

表示计划停歇发生在一周中的哪一天。out_of_sync_outage_weekday_mask 的数据类型为 int,其默认值为 NULL。它可以是下列值中的一个或多个。

1 星期日
2 星期一
4 星期二
8 星期三
16 星期四
32 星期五
64 星期六

返回代码值

0(成功)或 1(失败)

注释

此存储过程既在表 log_shipping_primaries 中更新主服务器,又在表 log_shipping_secondaries 中更新辅助服务器。

权限

只有 sysadmin 固定服务器角色的成员才能执行 sp_update_log_shipping_monitor_info