合并复制元数据由合并代理根据发布的保留设置定期进行清理。 这发生在发布服务器和订阅服务器的MSmerge_genhistory、MSmerge_contents、MSmerge_tombstone、MSmerge_past_partition_mappings和MSmerge_current_partition_mappings系统表中。 还可以使用复制存储过程以编程方式清理这些表中的数据。
手动清理合并元数据
在发布服务器上,对发布数据库执行 sp_mergemetadataretentioncleanup。
(可选)请注意步骤 1 中从 MSmerge_genhistory、 MSmerge_contents和 MSmerge_tombstone 系统表中删除的行数,分别在 @num_genhistory_rows、 @num_contents_rows和 @num_tombstone_rows 输出参数中返回。
在订阅服务器上重复步骤 1 和 2 以清理订阅数据库上的元数据。