locked
script for drop / disable and create / enable replication. RRS feed

  • Question

  • Hi all,

    I am trying to use the continues integration using VS 2015, But facing error. in the following thread, I have explained  Replication error during Continues Integration using VS 2015

    In some forums it says no solution and some with solution but didn't work for me.

    Now, I want to find some ways to disable the replications then build / release and deploy the code in VS2015, After successfully deployment Enable the replication.

    can anyone help me to write this code.

    Wednesday, May 3, 2017 6:40 AM

All replies

  • sp_removedbreplication will remove all replication components from a database.
    Wednesday, May 3, 2017 10:01 AM
    Answerer
  • thanks for your reply.

    Basically I want to make a workaround, follow the steps and make the Continues Integration DACPAC done.

    1. remove the replication

    2. run the DACPAC / Continues Integration ( which will push the changes from VS2015 database project to Database)

    3. Enable the replication

    for this purpose I created the script from "Replication components to Scripts" but when I try to create replication it gives error:

    Msg 20028, Level 16, State 1, Procedure sp_MSpublishdb, Line 56
    The Distributor has not been installed correctly. Could not enable database for publishing.
    The replication option 'publish' of database 'rap' has been set to false.
    Msg 14013, Level 16, State 1, Procedure sp_MSrepl_addlogreader_agent, Line 38
    This database is not enabled for publication.
    Msg 14013, Level 16, State 1, Procedure sp_MSrepl_addpublication, Line 175
    This database is not enabled for publication.
    Msg 18757, Level 16, State 1, Procedure sp_MSrepl_addpublication_snapshot, Line 66
    Unable to execute procedure. The database is not published. Execute the procedure in a database that is published for replication.
    Msg 14071, Level 16, State 1, Procedure sp_grant_publication_access, Line 61
    Could not find the Distributor or the distribution database for the local server. The Distributor may not be installed, or the local server may not be configured as a Publisher at the Distributor.
    Msg 14071, Level 16, State 1, Procedure sp_grant_publication_access, Line 61
    Could not find the Distributor or the distribution database for the local server. The Distributor may not be installed, or the local server may not be configured as a Publisher at the Distributor.
    Msg 14071, Level 16, State 1, Procedure sp_grant_publication_access, Line 61
    Could not find the Distributor or the distribution database for the local server. The Distributor may not be installed, or the local server may not be configured as a Publisher at the Distributor.
    Msg 14071, Level 16, State 1, Procedure sp_grant_publication_access, Line 61
    Could not find the Distributor or the distribution database for the local server. The Distributor may not be installed, or the local server may not be configured as a Publisher at the Distributor.

    Wednesday, May 3, 2017 10:39 AM
  • It looks like your distributor has not been installed. You will need to install it. Right click on the replication folder and follow the prompts.
    Wednesday, May 3, 2017 3:08 PM
    Answerer
  • hi,

    I have created distribution and subscription on serverA, and publication on serverB. The above error is facing on ServerB when creating publisher.

    Do I need to create publisher on serverB?

    br/

    Thursday, May 4, 2017 6:11 AM
  • Yes you would need to enable Server B as a publisher that uses the distributor on Server A.
    • Proposed as answer by Teige Gao Thursday, May 18, 2017 8:39 AM
    Thursday, May 4, 2017 10:42 AM
    Answerer