Clean Up Merge Metadata (Replication Transact-SQL Programming)
Merge replication metadata is cleaned up periodically by the Merge Agent based on the retention setting for the publication. This occurs at the Publisher and Subscriber in the MSmerge_genhistory, MSmerge_contents, MSmerge_tombstone, MSmerge_past_partition_mappings, and MSmerge_current_partition_mappings system tables. You can also programmatically clean up the data in these tables using replication stored procedures.
To manually clean up merge metadata
At the Publisher on the publication database, execute sp_mergemetadataretentioncleanup.
Repeat steps 1 and 2 at the Subscriber to clean up metadata on the subscription database.