Removing a corrupted merge subscription...

  • Hello to all,

    Thanks for all your time and assistence and any input is greatly appreciated.

    I currently have a server that has merge replication setup on it and of course having some issues. This was setup in a manner that the Server will use a application and take data from about 50 laptop and this is my best option in my eyes. Anyways.. jsut giving a bit of background.

    The Publication is on Server A and once of the subscriptions is not allowing me to delete or remove it. When i went to look at the subscriber Laptop A the database that the subscription was created for was deleted by someone else.ggrrr This has since given me problems simply because when i try to remove the subscription Server A tries to connect to the database but its no longer there 🙁 and then the deletion blows up. Soo i was thinking ok... i can work around this and use some T-SQL code sp_dropmergesubscrition well i try this and when i run it on the Publisher is says completes successfully YET the subscription is still there. There is no right clicking and delete or anything that is going to be THAT simple in this situation.. i could only wish. 🙂

    I have tried to use the sp_cleanup_subscription thinking it would work after the sp_dropmergesubscription dropped it and again..all commands complete with success but the subsctiption remains.

    Would blowing away the distribution database help or make matter worse?

    I am thinking of a quick rebuild since early on but see this as a learning opportunity for a situation i have never encountered...Any thoughts or comments are greatly appreciate.

    DHeath

  • What parameters you are passing in sp_dropmergesubscription?

    take a look in the code of sp_dropmergesubscription and see if you running on any valid sequence. May be SP is running successfully but not doing anything?

  • Your response is greatly appreciated...thank you

    I think you are right at some level because I am passing all the information to the Publisher but nothing is happening but not sure how you check that to make sure its working. If I do put in wrong data or anything it does error out saying it cant find the subscription or whatever IF I purposely put in incorrect information. So that tells me its making the correct connections on the internals of MSSQL..(unless I am mistaken, which is very possible)

    the code looks like this

    DECLARE @publication AS sysname;

    DECLARE @subscriber AS sysname;

    DECLARE @subscriptionDB AS sysname;

    DECLARE @subscription_type AS sysname;

    SET @publication = N'Sandoval_Publication';

    SET @subscriber = $(Client Name);

    SET @subscription_type = 'ALL'

    SET @subscriptionDB = N'Sanrep';

    USE [Sandoval]

    EXEC sp_dropmergesubscription

    @publication = @publication,

    @subscriber = @subscriber,

    @subscription_type = @subscription_type

    @subscriber_db = @subscriptionDB;

    GO

    DHeath

  • what value SET @subscriber = $(Client Name) is returning ? Do you know subscriber name, so you can pass directly?

  • Yes... I do know the client name and cant remember off the top of my head but in that particular statement it was directly to the client and made the connection with no issues.

    Sorry for the confusion...the code is going directly to the client when the "Client name" aspects is fill in properly.

    Thanks for your time

    DHeath

  • Not sure why this was this way but it worked so its fixed 🙂 wooo hooooo

    use [database name]

    sp_droppublication @publication='publication_name', @ignore_distributor = 1

    then restarted the services..and the publication was still there then I tried the following code

    USE master

    EXEC sp_removedbreplication @dbname='DB_NAME'

    GO

    exec sp_dropsubscription @subscriber='subscription_name'-- If you find anything under +

    exec sp_droppublication 'publication name'

    And this above worked and got rid of the orphaned subscriptions and all..wooo hoooo again

    I then followed up with dropping the distribution db so that I can start all over from scratch. Which will be perfect and I don't have to do a re-install

    --dropping distribution db

    use master

    go

    alter database distribution set offline;

    drop database distribution;

    Thanks for everyone' s assistance...greatly appreciated.

    DHeath

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply