sp_MSchange_snapshot_agent_properties (Transact-SQL)
适用于:SQL Server
更改在 Microsoft SQL Server 2005 (9.x) 或更高版本分发服务器上运行的快照代理作业的属性。 当发布服务器在 Microsoft SQL Server 2000 (8.x) 实例上运行时,此存储过程用于更改属性。 此存储过程在分发服务器上对分发数据库执行。
语法
sp_MSchange_snapshot_agent_properties [ @publisher = ] 'publisher'
, [ @publisher_db = ] 'publisher_db'
, [ @publication = ] 'publication'
, [ @frequency_type= ] frequency_type
, [ @frequency_interval= ] frequency_interval
, [ @frequency_subday= ] frequency_subday
, [ @frequency_subday_interval= ] frequency_subday_interval
, [ @frequency_relative_interval= ] frequency_relative_interval
, [ @frequency_recurrence_factor= ] frequency_recurrence_factor
, [ @active_start_date= ] active_start_date
, [ @active_end_date= ] active_end_date
, [ @active_start_time_of_day= ] active_start_time_of_day
, [ @active_end_time_of_day= ] active_end_time_of_day
, [ @snapshot_job_name = ] 'snapshot_agent_name'
, [ @publisher_security_mode = ] publisher_security_mode
, [ @publisher_login = ] 'publisher_login'
, [ @publisher_password = ] 'publisher_password'
, [ @job_login = ] 'job_login'
, [ @job_password = ] 'job_password'
, [ @publisher_type = ] 'publisher_type'
参数
[ @publisher = ] 'publisher'
发布服务器的名称。 publisher 为 sysname,没有默认值。
[ @publisher_db = ] 'publisher_db'
发布数据库的名称。 publisher_db为 sysname,无默认值。
[ @publication = ] 'publication'
发布的名称。 publication 为 sysname,无默认值。
[ @frequency_type = ] frequency_type
执行快照代理的频率。 frequency_type 为 int,可以是以下值之一。
值 | 说明 |
---|---|
1 | 一次 |
2 | 按需 |
4 | 每日 |
8 | 每周 |
10 | 每月一次 |
20 | 每月,相对于频率间隔 |
40 | SQL Server 代理启动时 |
[ @frequency_interval = ] frequency_interval
要应用于frequency_type设置的频率的值。 frequency_interval为 int,无默认值。
[ @frequency_subday = ] frequency_subday
freq_subday_interval的单位。 frequency_subday为 int,可以是其中一个值。
值 | 说明 |
---|---|
1 | 一次 |
2 | Second |
4 | Minute |
8 | 小时 |
[ @frequency_subday_interval = ] frequency_subday_interval
frequency_subday的间隔。 frequency_subday_interval为 int,无默认值。
[ @frequency_relative_interval = ] frequency_relative_interval
快照代理运行的日期。 frequency_relative_interval为 int,无默认值。
[ @frequency_recurrence_factor = ] frequency_recurrence_factor
frequency_type使用的重复因子。 frequency_recurrence_factor为 int,无默认值。
[ @active_start_date = ] active_start_date
首次计划快照代理的日期,格式为 yyyyMMdd
。 active_start_date为 int,无默认值。
[ @active_end_date = ] active_end_date
快照代理停止计划的日期,格式为 yyyyMMdd
。 active_end_date 为 int,无默认值。
[ @active_start_time_of_day = ] active_start_time_of_day
第一次计划快照代理的时间,格式为 HHmmss
。 active_start_time_of_day为 int,无默认值。
[ @active_end_time_of_day = ] active_end_time_of_day
快照代理停止计划的时间,格式为 HHmmss
. active_end_time_of_day为 int,无默认值。
[ @snapshot_job_name = ] 'snapshot_agent_name'
如果使用现有作业,则为现有快照代理作业名称的名称。 snapshot_agent_name 为 nvarchar(100),没有默认值。
[ @publisher_security_mode = ] publisher_security_mode
连接到发布服务器时代理使用的安全模式。 publisher_security_mode为 int,无默认值。 0 指定 SQL Server 身份验证, 1 指定 Windows 身份验证。 必须为非 SQL Server 发布服务器指定值 0 。 请尽可能使用 Windows 身份验证。
[ @publisher_login = ] 'publisher_login'
连接到发布服务器时使用的登录名。 publisher_login为 sysname,无默认值。 当publisher_security_mode为 0 时,必须指定publisher_login。 如果publisher_login为 NULL,publisher*_*security_mode为 1,则在连接到发布服务器时将使用job_login中指定的 Windows 帐户。
[ @publisher_password = ] 'publisher_password'
连接到发布服务器时使用的密码。 publisher_password 为 nvarchar(524),没有默认值。
重要
请不要将身份验证信息存储在脚本文件中。 为了提高安全性,建议您在运行时提供登录名和密码。
[ @job_login = ] 'job_login'
代理在其中运行的 Windows 帐户的登录名。 job_login为 nvarchar(257),没有默认值。 此 Windows 帐户总是用于与分发服务器建立代理连接。 创建新的快照代理作业时,必须提供此参数。 对于非 SQL Server 发布服务器,无法更改此项。
[ @job_password = ] 'job_password'
运行代理的 Windows 帐户的密码。 job_password 为 sysname,无默认值。 创建新的快照代理作业时,必须提供此参数。
重要
请不要将身份验证信息存储在脚本文件中。 为了提高安全性,建议您在运行时提供登录名和密码。
[ @publisher_type = ] 'publisher_type'
指定发布服务器未在 SQL Server 实例中运行时的发布服务器类型。 publisher_type 为 sysname,可以是以下值之一。
值 | 说明 |
---|---|
MSSQLSERVER | 指定 SQL Server 发布服务器。 |
神谕 | 指定标准的 Oracle 发布服务器。 |
ORACLE 网关 | 指定 Oracle 网关发布服务器。 |
有关 Oracle 发布服务器与 Oracle 网关发布服务器之间的差异的详细信息,请参阅 Oracle 发布概述。
返回代码值
0 (成功) 或 1 (失败)
注解
sp_MSchange_snapshot_agent_properties用于快照复制、事务复制和合并复制。
在执行sp_MSchange_snapshot_agent_properties时,必须指定所有参数。 执行sp_helppublication_snapshot以返回快照代理作业的当前属性。
当发布服务器在 SQL Server 2005(9.x) 或更高版本的实例上运行时,应使用sp_changepublication_snapshot来更改快照代理作业的属性。
权限
只有分发服务器上 sysadmin 固定服务器角色的成员才能执行sp_MSchange_snapshot_agent_properties。