sp_changedistributiondb (Transact-SQL)
Applies to: SQL Server Azure SQL Managed Instance
Changes the properties of the distribution database. This stored procedure is executed at the Distributor on any database.
Transact-SQL syntax conventions
Syntax
sp_changedistributiondb [ @database= ] 'database'
[ , [ @property= ] 'property' ]
[ , [ @value= ] 'value' ]
Arguments
[ @database = ] 'database'
Is the name of the distribution database. database is sysname, with no default.
[ @property = ] 'property'
Is the property to change for the given database. property is sysname, and can be one of these values.
Value | Description |
---|---|
history_retention | History table retention period. |
max_distretention | Maximum distribution retention period. |
min_distretention | Minimum distribution retention period. |
NULL (default) | All available property values are printed. |
[ @value = ] 'value'
Is the new value for the specified property. value is nvarchar(255), with a default of NULL.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_changedistributiondb is used in all types of replication.
Example
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
Permissions
Only members of the sysadmin fixed server role can execute sp_changedistributiondb.
See Also
View and Modify Distributor and Publisher Properties
sp_adddistributiondb (Transact-SQL)
sp_dropdistributiondb (Transact-SQL)
sp_helpdistributiondb (Transact-SQL)
Replication Stored Procedures (Transact-SQL)
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho