Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Distribution Clean Up Not Deleting from Distribution DB

$
0
0

The proc called by the clean up job sp_MSdistribution_cleanup runs for a few minutes, but does not delete any rows.  The distribution db has gotten very large (130GB).  Because this proc is not working, I have had to delete from MSrepl_transactions and MSrepl_commands manually.

This started when a publication had to be dropped and recreated.  It had to be dropped because we could not add a new article to it.  Getting strange errors.  Ever since then, distribution database growing.

immediate_sync and allow_anonymous = 0 for all publications.  This was changed around the time of the publication drop and create.

What I have found:

sp_MSmaximum_cleanup_seqno returns 0x00.

In that proc, it populates a cursor from the following query:

select a.id, min(s2.subscription_seqno) from
                        MSsubscriptions s2 
                        join MSdistribution_agents a
                        on (a.id = s2.agent_id) 
                        where
	                        s2.status in( @active, @initiated ) and
	                        /* Note must filter out virtual anonymous agents !!!
                                      a.subscriber_id <> @virtual_anonymous and */
                            -- filter out subscriptions to immediate_sync publications
                            not exists (select * from MSpublications p where
                                        s2.publication_id = p.publication_id and
                                        p.immediate_sync = 1) and
	                        a.publisher_database_id = @publisher_database_id
	                        group by a.id

A little further down in the proc is this line:

select top 1 @max_agent_hist_xact_seqno = xact_seqno from MSdistribution_history where agent_id = @agent_id 
	             order by timestamp desc

For one of the agent_ids in the cursor, the value for xact_seqno is 0x00000000000000000000000000000000.

The distribution agent in question has a subscriber db of "virtual".  In addition, there are two virtual rows from MSSsubscriptions.  Both of the article_ids from these rows do not exist in MSarticles.

So, it looks like my meta data is messed up.  I have a call into Microsoft, but it has been a few days and they haven't come up with a solution.  I would like to delete the "bad" meta data.  Is that possible?

Thanks.

Mike







Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>