Saturday, February 25, 2012

removing deactivated subscriptions

Hi


We are using merge replication - how do we remove deactivated subscriptions from the replication monitor at the publisher. These are anonymous HTTPS subscribers....

Thanks

Bruce

I use this stored procedure which runs against the distribution database:

CREATE PROCEDURE [dbo].[usp_DeleteMergeAgentSessions]

@.Publication [nvarchar](50),

@.Subscriber [nvarchar](50),

@.Database [nvarchar](50) = NULL

AS

SET NOCOUNT ON

DELETE FROM [msmerge_sessions] WHERE [agent_id] IN (SELECT [id] FROM [msmerge_agents] WHERE [publication] = @.Publication AND [subscriber_name] = @.Subscriber AND (@.Database IS NULL OR @.Database = [subscriber_db]))

DELETE FROM [msmerge_agents] WHERE [publication] = @.Publication AND [subscriber_name] = @.Subscriber AND (@.Database IS NULL OR @.Database = [subscriber_db])

No comments:

Post a Comment