Hello,
I’m sorry to have to post again but I just want to clarify some things
so that I can understand and take care of thess once and for all. I
realize that this post is very lengtly, because believe it or not I have
spent a lot of time since my original post looking into merge
replication metadata cleanup but I’m starting to think I’ve only become
more confused by it. If you would be so kind as to assist me again I
would greatly appreciate it.
Specific to my Issue:
It is not expected that the subscriber would ever be offline, however to
plan for an emergency I think 4 days would be sufficient. So I’d need
to change both the Subscription Retention and History retention to 4
days, following your directions from an earlier post.
In our development environment I changed Transaction retention / Store
Transactions, History Retention, and Subscription retention all to 4
days. But when I run the Agent history clean up: distribution and the
Distribution clean up: distribution jobs records in MSmerge_history
table are not being deleted, when there are clearly records with a time
value older than 4 days. When I run (SELECT * from msmerge_history where
msmerge_history.time <= getdate()-4) the results are around 65K records.
I’ve tried stopping and then restarting the Merge jobs and I’ve also
tried stopping and restarting the SQL Server Agent and still no records
are deleted. What am I doing wrong? The only thing I can think of is
that all publications allow anonymous subscriptions; could this setting
be what is keeping the old data from being purged?
In General:
Here are some more generalized questions I still have about the merge
replication cleanup process…
Are Subscription Expiration and Publication Retention are the same
things?
Do the Transaction retention / Store Transactions: values only matter
if you are using Transactional Replication?
My understanding is that metadata cleanup in merge replication is also
performed every time the Merge Agent runs for a subscription by the
stored procedure sp_mergemetadataretentioncleanup and that it removes
metadata older than the publication retention period from the following
system tables on both the publisher and subscriber databases:
• MSmerge_contents
• MSmerge_tombstone
• MSmerge_genhistory
• MSmerge_current_partition_mappings
• MSmerge_past_partition_mappings
• MSmerge_generation_partition_mappings
My questions regarding this are:
If this is done every time the Merge Agent runs for a subscription what
happens if our Merge Agent is set to run continuously?
Do I need to create a separate job to execute this stored procedure?
(DELETE * from msmerge_history where msmerge_history.time <=
getdate()-4)
If so, on what type of schedule should it be run (every 10 minutes)?
Currently there are no jobs scheduled on Subscriber for any type of
cleanup. I am assuming that they are handled by jobs that run on the
publisher side?
I noticed that on all 4 of the publisher databases the table
MSmerge_history is empty but on the subscriber databases this table had
at this time 12K+ rows? Is this normal?
I’ll gladly try putting all of this information together in a more
comprehensive format and posting it back in hopes that it will be
beneficial to others. It looks like there has been a lot of chatter
about this lately.
Again thank you very much for your time and insight. Barbara
*** Sent via Developersdex
http://www.developersdex.com ***
>> Stay informed about: MSmerge_history - Production Issue