Partilhar via


How to: Configure Peer-to-Peer Transactional Replication (Replication Transact-SQL Programming)

Configuring a peer-to-peer replication topology is very similar to configuring a series of standard transactional publications and subscriptions using replication stored procedures. The initial data must be present on each node before the topology is configured. For more information about this type of transactional replication topology, see Peer-to-Peer Transactional Replication.

Note

Each node in a peer-to-peer topology should already be configured as a Publisher and be associated with a local or remote Distributor. If you use a remote Distributor, we recommend you do not use the same remote Distributor for all nodes because this is potentially a single point of failure.

Procedure

To set up peer-to-peer replication among three nodes

  1. Use Microsoft SQL Server backup and restore functionality to initialize data for the publication at each node on the topology. For more information, see Copying Databases with Backup and Restore.

  2. At node A, execute sp_addpublication (Transact-SQL). Specify a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.

  3. At node A, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node B as @subscriber, the name of the target database at node B as @destination_db, and a value of replication support only for @sync_type.

  4. At node A, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node C as @subscriber, the name of the target database at node C as @destination_db, and a value of replication support only for @sync_type.

  5. At node B, execute sp_addpublication (Transact-SQL). Specify the name of the publication created in step 2 for @publication, a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.

  6. At node B, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node A as @subscriber, the name of the target database at node A as @destination_db, and a value of replication support only for @sync_type.

  7. At node B, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node C as @subscriber, the name of the target database at node C as @destination_db, and a value of replication support only for @sync_type.

  8. At node C, execute sp_addpublication (Transact-SQL). Specify the name of the publication created in step 2 for @publication, a value of true for @enabled_for_p2p, a value of active for @status and a value of true for @allow_initialize_from_backup.

  9. At node C, execute sp_addsubscription (Transact-SQL). Specify the name of the publication created in step 2 as @publication, the name of node A as @subscriber, the name of the target database at node A as @destination_db, and a value of replication support only for @sync_type.

  10. At node C, again execute sp_addsubscription (Transact-SQL). This time, specify the name of the publication created in step 2 as @publication, the name of node B as @subscriber, the name of the target database at node B as @destination_db, and a value of replication support only for @sync_type.

See Also

Tasks

How to: Configure Nonpartitioned, Bidirectional, Transactional Replication (Replication Transact-SQL Programming)

Concepts

Programming Replication Using System Stored Procedures

Help and Information

Getting SQL Server 2005 Assistance