Replication Definitions and Subscriptions for Alternate Connections

A replication definition that you create for a primary database applies to all primary connections, default and alternate, between the Replication Server that controls the replication definition and the primary database. Therefore, you must drop all replication definitions for the primary database before you drop the last primary connection to the primary database.

With system version 1570, you can create replication definitions and publications only against a database. The name you specify for the with primary at clause of the create replication definition command must be the primary database name.

Since all primary connections between a primary database and a Replication Server share all replication definitions, you must specify in the subscription which primary connection is the data source and which replicate connection is the replication target. Specify the corresponding default or alternate connection name in the with primary and the with replicate clause of create subscription. If you do not specify a connection name in the with primary clause, Replication Server creates the subscription against the default primary connection to the primary database.
create subscription sub_name
for {table_repdef | func_repdef | publication pub |
database replication definition db_repdef}
with primary at data_server.database
with replicate at data_server.database
[where {column_name | @param_name}
       {< | > | >= | <= | = | &} value
[and {column_name | @param_name}
     {< | > | >= | <= | = | &} value]...]
[without holdlock | incrementally | without materialization]
[subscribe to truncate table]
[for new articles]

When you upgrade from a Replication Server version that does not support alternate connections, all subscriptions remain defined against the default primary connection and default replicate connection in the upgraded Replication Server.

Example 1 – Subscribe to an Alternate Primary Connection

To create the sub_conn2 susbcription against the repdef_conn2 replication definition on the LON_DS.pdb_conn2 alternate primary connection to the LON_DS primary data server where NY_DS.rdb is the default replicate connection, enter:
create subscription sub_conn2 for repdef_conn2
with primary at LON_DS.pdb_conn2
with replicate at NY_DS.rdb
without materialization
go

Example 2 – Subscribe to an Alternate Replicate Connection

To create the sub_conn2 susbcription for the repdef_conn2 replication definition on the NY_DS.rdb_conn2 alternate replicate connection, enter:
create subscription sub_conn2 for repdef_conn2
with replicate at NY_DS.rdb_conn2
without materialization
go