sp_mergemetadataretentioncleanup (Transact-SQL)

MSmerge_genhistoryMSmerge_contentsMSmerge_tombstoneMSmerge_past_partition_mappingsMSmerge_current_partition_mappings 系统表中手动清除元数据。 此存储过程在每个发布服务器和订阅服务器的拓扑中执行。

主题链接图标Transact-SQL 语法约定

语法

sp_mergemetadataretentioncleanup [ [ @num_genhistory_rows = ] num_genhistory_rows OUTPUT ]
    [ , [ @num_contents_rows = ] num_contents_rows OUTPUT ] 
    [ , [ @num_tombstone_rows = ] num_tombstone_rows OUTPUT ] 
    [ , [ @aggressive_cleanup_only = ] aggressive_cleanup_only ]

参数

  • [ @num_genhistory_rows= ] num_genhistory_rows OUTPUT
    返回从 MSmerge_genhistory 表中清除的行数。num_genhistory_rows 的数据类型为 int,默认值为 0

  • [ @num_contents_rows= ] num_contents_rows OUTPUT
    返回从 MSmerge_contents 表中清除的行数。num_contents_rows 的数据类型为 int,默认值为 0

  • [ @num_tombstone_rows= ] num_tombstone_rows OUTPUT
    返回从 MSmerge_tombstone 表中清除的行数。num_tombstone_rows 的数据类型为 int,默认值为 0

  • [ @aggressive_cleanup_only= ] aggressive_cleanup_only
    仅供内部使用。

返回代码值

0(成功)或 1(失败)

注释

有关元数据清除操作的详细信息,请参阅合并复制的工作机制

重要说明重要提示

如果在数据库上有多个发布,并且其中任何一个发布都使用无限发布保持期,则运行 sp_mergemetadataretentioncleanup 不会清除数据库的合并复制更改跟踪元数据。 因此,使用无限发布保持时要格外小心。 若要确定发布是否具有无限保持期,请在发布服务器上执行 sp_helpmergepublication (Transact-SQL),并注意结果集中 retention0 值的所有发布。

权限

只有 db_owner 固定数据库角色成员或已发布数据库的发布访问列表中的用户才能执行 sp_mergemetadataretentioncleanup