为分发代理程序和合并代理程序添加调度。此存储过程在发布服务器的任何数据库上执行。
sp_addsubscriber_schedule [ @subscriber = ] 'subscriber'
[ , [ @agent_type = ] agent_type ]
[ , [ @frequency_type = ] frequency_type ]
[ , [ @frequency_interval = ] frequency_interval ]
[ , [ @frequency_relative_interval = ] frequency_relative_interval ]
[ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
[ , [ @frequency_subday = ] frequency_subday ]
[ , [ @frequency_subday_interval = ] frequency_subday_interval ]
[ , [ @active_start_time_of_day = ] active_start_time_of_day ]
[ , [ @active_end_time_of_day = ] active_end_time_of_day ]
[ , [ @active_start_date = ] active_start_date ]
[ , [ @active_end_date = ] active_end_date ]
[@subscriber = ] 'subscriber'
是订阅服务器名。subscriber 的数据类型为 sysname。订阅服务器名在数据库内必须唯一,不能已存在,而且不能为 NULL。
[@agent_type = ] agent_type
是代理程序的类型,agent_type 的数据类型为 smallint,可以是下列值之一。
值 | 描述 |
---|---|
0(默认值) | 分发代理程序 |
1 | 合并代理程序 |
[@frequency_type = ] frequency_type
是调度分发代理程序所用的频率。frequency_type 的数据类型为 int,可以是下列值之一。
值 | 描述 |
---|---|
1 | 一次 |
2 | 按需 |
4 | 每天 |
8 | 每周 |
16 | 每月 |
32 | 每月相对信息 |
64(默认值) | 自动启动 |
124 | 反复出现 |
[@frequency_interval = ] frequency_interval
是应用于 frequency_type 所设置频率的值。frequency_interval 的数据类型为 int,默认设置为 1。
[@frequency_relative_interval = ] frequency_relative_interval
是分发代理程序运行的日期。当 frequency_type 设置为 32(每月相对信息)时使用该参数。frequency_relative_interval 的数据类型为 int,可以是下列值之一。
值 | 描述 |
---|---|
1(默认值) | 第一个 |
2 | 秒 |
4 | 第三个 |
8 | 第四个 |
16 | 最后一个 |
[@frequency_recurrence_factor = ] frequency_recurrence_factor
是 frequency_type 使用的重复因子。frequency_recurrence_factor 的数据类型为 int,默认设置为 0。
[@frequency_subday = ] frequency_subday
是在定义的周期内重新调度的频率。frequency_subday 的数据类型为 int,可以是下列值之一。
值 | 描述 |
---|---|
1 | 一次 |
2 | 秒 |
4(默认值) | 分钟 |
8 | 小时 |
[@frequency_subday_interval = ] frequency_subday_interval
是 frequency_subday 的间隔。frequency_subday_interval 的数据类型为 int,默认设置为 5。
[@active_start_time_of_day = ] active_start_time_of_day
是第一次调度分发代理程序的时间,格式为 HHMMSS。active_start_time_of_day 的数据类型为 int,默认设置为 0。
[@active_end_time_of_day = ] active_end_time_of_day
是停止调度分发代理程序的时间,格式为 HHMMSS。active_end_time_of_day 的数据类型为 int,默认设置为 235959,表示 24 小时制的 11:59:59 P.M.。
[@active_start_date = ] active_start_date
是第一次调度分发代理程序的日期,格式为 YYYYMMDD。active_start_date 的数据类型为 int,默认设置为 0。
[@active_end_date = ] active_end_date
是停止调度分发代理程序的日期,格式为 YYYYMMDD。active_end_date 的数据类型为 int,默认设置为 99991231,表示 9999 年 12 月 31 日。
0(成功)或 1(失败)
sp_addsubscriber_schedule 用于快照复制、事务复制和合并复制。
只有 sysadmin 固定服务器角色成员才能执行 sp_addsubscriber_schedule。