sp_changesubscriber_schedule (Transact-SQL)

适用于: SQL Server Azure SQL 托管实例

更改订阅服务器的分发代理或合并代理调度。 此存储过程在发布服务器的任何数据库中执行。

Transact-SQL 语法约定

语法

sp_changesubscriber_schedule
    [ @subscriber = ] N'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 ]
    [ , [ @publisher = ] N'publisher' ]
[ ; ]

参数

[ @subscriber = ] N'subscriber'

订阅服务器的名称。 @subscribersysname,无默认值。 订阅服务器的名称在数据库中必须唯一,并且不能存在 NULL

[ @agent_type = ] agent_type

代理的类型。 @agent_type为 smallint,默认值为 0.

  • 0指示分发代理。
  • 1指示合并代理。

[ @frequency_type = ] frequency_type

指定计划分发任务的频率。 @frequency_type为 int,可以是这些值之一。

说明
1 一次
2 按需
4 每日
8 每周
16 每月
32 与“每月”选项相关
64(默认值) 自动启动
128 定期

[ @frequency_interval = ] frequency_interval

应用于由 @frequency_type设置的频率的值。 @frequency_interval为 int,取决于@frequency_type的值

@frequency_type的值 @frequency_interval的影响
1(默认值) @frequency_interval未使用。
4 @frequency_interval 天。
8 @frequency_interval是以下一个或多个(与 | 结合使用)(按位或)(Transact-SQL)逻辑运算符):

1 = 星期日
2 = 星期一
4 = 星期二
8 = 星期三
16 = 星期四
32 = 星期五
64 = 星期六
16 月@frequency_interval 日。
32 @frequency_interval是以下选项之一:

1 = 星期日
2 = 星期一
3 = 星期二
4 = 星期三
5 = 星期四
6 = 星期五
7 = 星期六
8 = 天
9 = 工作日
10 = 周末日期
64 @frequency_interval未使用。
128 @frequency_interval未使用。

[ @frequency_relative_interval = ] frequency_relative_interval

分发任务的日期。 @frequency_relative_interval为 int,可以是其中一个值。

说明
1(默认值) 第一个
2 第二个
4 第三个
8 第四
16 Last

[ @frequency_recurrence_factor = ] frequency_recurrence_factor

@frequency_type使用的重复因子。 @frequency_recurrence_factor为 int,默认值为 0.

[ @frequency_subday = ] frequency_subday

指定在定义的时间段内重新安排的频率(以分钟为单位)。 @frequency_subdayint,可以是以下值之一。

说明
1 一次
2 Second
4(默认值) Minute
8 小时

[ @frequency_subday_interval = ] frequency_subday_interval

每次执行作业之间发生的frequency_subday句点数@frequency_subday_interval为 int,默认值为 5.

[ @active_start_time_of_day = ] active_start_time_of_day

首次计划分发任务的时间。 @active_start_time_of_day为 int,默认值为 NULL.

[ @active_end_time_of_day = ] active_end_time_of_day

分发任务停止计划的时间。 @active_end_time_of_day为 int,默认值235959为 24 小时,表示下午 11:59:59。

[ @active_start_date = ] active_start_date

首次计划分发任务的日期,格式为 yyyyMMdd. @active_start_date为 int,默认值为 NULL.

[ @active_end_date = ] active_end_date

分发任务停止计划的日期,格式为 yyyyMMdd@active_end_dateint,默认值 99991231为 9999 年 12 月 31 日。

[ @publisher = ] N'publisher'

指定非 SQL Server 发布服务器。 @publisher为 sysname,默认值为 NULL.

更改 SQL Server 发布服务器上的项目属性时,不应使用@publisher。

返回代码值

0(成功)或 1(失败)。

注解

sp_changesubscriber_schedule 用于所有类型的复制。

权限

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