sp_changedistributiondb (Transact-SQL)

适用于:SQL ServerAzure SQL 托管实例

更改分发数据库的属性。 此存储过程在分发服务器上的任何数据库中执行。

Transact-SQL 语法约定

语法

  
sp_changedistributiondb [ @database= ] 'database'   
    [ , [ @property= ] 'property' ]   
    [ , [ @value= ] 'value' ]  

参数

[ @database = ] 'database' 分发数据库的名称。 数据库sysname,无默认值。

[ @property = ] 'property' 要更改给定数据库的属性。 属性sysname,可以是以下值之一。

说明
history_retention 历史记录表保持期。
max_distretention 最大分发保持期。
min_distretention 最小分发保持期。
NULL(默认值) 打印所有可用的 属性值

[ @value = ] 'value' 指定属性的新值。 值为 nvarchar(255),默认值为 NULL。

返回代码值

0 (成功) 或 1 (失败)

备注

sp_changedistributiondb用于所有类型的副本 (replica)。

示例

DECLARE @distributionDB AS sysname;
SET @distributionDB = N'distribution';

-- Change the history retention period to 24 hours and the
-- maximum retention period to 48 hours.  
USE distribution
EXEC sp_changedistributiondb @distributionDB, N'history_retention', 24
EXEC sp_changedistributiondb @distributionDB, N'max_distretention', 48
GO

权限

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

另请参阅

查看和修改分发服务器和发布服务器属性
sp_adddistributiondb (Transact-SQL)
sp_dropdistributiondb (Transact-SQL)
sp_helpdistributiondb (Transact-SQL)
复制存储过程 (Transact-SQL)