Transact-SQL 参考

sp_update_log_shipping_plan

更新有关现有日志传送计划的信息。

语法

sp_update_log_shipping_plan [@plan_id =] plan_id,
    [@plan_name =] 'plan_name',
    [@description =] 'description',
    [@source_server =] 'source_server',
    [@source_dir =] 'source_dir',
    [@destination_dir =] 'destination_dir',
    [@copy_job_id =] copy_job_id,
    [@load_job_id =] load_job_id,
    [@history_retention_period =] history_retention_period,
    [@file_retention_period =] file_retention_period

参数

[@plan_id =] plan_id

是数据库所属于的计划的标识号。plan_id 的数据类型为 uniqueidentifier,其默认值为 NULL。

[@plan_name =] 'plan_name'

是数据库所属于的计划的名称。plan_name 的数据类型为 sysname,其默认值为 NULL。

说明  必须指定 plan_idplan_name 两者之一,但不能两者都指定。

[@description =] 'description'

是计划的描述。description 的数据类型为 nvarchar(500),其默认值为 NULL。

[@source_server =] 'source_server'

是源服务器的名称。source_server 的数据类型为 sysname,其默认值为 NULL。

[@source_dir =] 'source_dir'

是目录的完整路径,事务日志文件将从该目录复制。source_dir 的数据类型为 nvarchar(500),其默认值为 NULL。

[@destination_dir =] 'destination_dir'

是复制事务日志文件的目的目录。destination_dir 的数据类型为 nvarchar(500),其默认值为 NULL。

[@copy_job_id =] copy_job_id

是复制作业的作业 ID。copy_job_id 的数据类型为 uniqueidentifier,其默认值为 NULL。

[@load_job_id =] load_job_id

是装载作业的作业 ID。load_job_id 的数据类型为 uniqueidentifier,其默认值为 NULL。

[@history_retention_period =] history_retention_period

是历史记录要保留的时间长度(以分钟计)。history_retention_period 的数据类型为 int,其默认值为 NULL。

[@file_retention_period =] file_retention_period

是事务日志文件复制后的保留时间长度(以分钟计)。file_retention_period 的数据类型为 int,其默认值为 NULL。

返回代码值

0(成功)或 1(失败)

权限

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

示例

下例用新的目的目录和文件保留期更新计划"Pubs database backup"。

EXEC   msdb.dbo.sp_update_log_shipping_plan
   @plan_name = N'Pubs database backup',
   @destination_dir = N'e:\log shipping',
   @history_retention_period = 4320