Setting up peer to peer replication programmatically

  • I'm actually running this command when an error occurs:

    --5. On node B, add the publication using sp_addpublication.

    --Node B

    use DB4Replication

    go

    sp_replicationdboption

    @dbname='DB4Replication',

    @optname='publish',

    @value='true'

    go

    /*Addition of the publication*/

    sp_addpublication

    @publication='pub_DB4Replication_peer',

    @restricted='false',

    @sync_method='native',

    @repl_freq='continuous',

    @status='active',

    @allow_push='true',

    @allow_pull='true',

    @immediate_sync='false',

    @allow_sync_tran='false',

    @autogen_sync_procs='false',

    @retention=60,

    @independent_agent='true',

    @enabled_for_p2p='true',

    @status='active',

    @allow_initialize_from_backup='true'

    go

    Error:

    Msg 20028, Level 16, State 1, Procedure sp_MSpublishdb, Line 55

    The Distributor has not been installed correctly. Could not enable database for publishing.

    The replication option 'publish' of database 'DB4Replication' has been set to false.

    Msg 8143, Level 16, State 1, Procedure sp_addpublication, Line 0

    Parameter '@status' was supplied multiple times.

  • Working sample code to review at:

    http://www.replicationanswers.com/Script3.asp

  • Fix duplicate parameters in sp_addpublication:

    Msg 8143, Level 16, State 1, Procedure sp_addpublication, Line 0

    Parameter '@status' was supplied multiple times.

    [/*Addition of the publication*/

    sp_addpublication

    @status='active',

    ...

    @status='active',

  • thanks dennis,

    I saw the other code from replicationanswers.com but I'm trying the code above first..

    anyway, the problem im encountering is the first part which is:

    --5. On node B, add the publication using sp_addpublication.

    --Node B

    use DB4Replication

    go

    sp_replicationdboption

    @dbname='DB4Replication',

    @optname='publish',

    @value='true'

    go

    when I'm running this code, I'm encountering the said error.

  • you need to enable the server as a distributor. I believe you have not done so, right?


    * Noel

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

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