Quantcast
Viewing all articles
Browse latest Browse all 3160

Configure One Way Merge Replication for SQL Server

Problem

We are using SQL Server Merge replication and we have a need to setup a one way publication. We needed Data Manipulation Language (DML) changes on the publisher to get replicated to one of the subscribers, but not from that subscriber to the publisher. In this tip we look at how this can be done.

Solution

Here is what the environment looks like. DB1 is the publisher database and DB2 and DB3 are subscriber databases. We have Merge replication already configured on DB1 and DB2 and the data needs to go both ways. Now we need replicate data from DB1 to DB3 and not from DB3 to DB1.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Steps to Configure one way Merge SQL Server Replication

Let's create a new SQL Server Merge publication called OneWay. Right click on Local Publications and select New Publication.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Select the DB1 database.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Add table and finish the wizard.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

We need to add the subscriber to this publication, so right click on the publication and select New Subscription.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Select the publication.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Specify where the Merge Agent will run.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Select the subscriber and subscription database and finish the wizard.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Now Launch Replication Monitor, by right clicking on Local Publications and selecting Launch Replication Monitor.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Go to the All Subscriptions tab and select View Details.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Go to the Merge Agent Job Properties.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

In the job you need to add -Exchange Type 2 to the command as shown below.


Image may be NSFW.
Clik here to view.
Configure One Way Merge Replication for SQL Server

Restart the Merge SQL Server Agent Job and one way Merge replication should now be configured.

Next Steps Please test in a QA environment first. Check out these other SQL Server Replication Tips . Last Update: 12/1/2016

Viewing all articles
Browse latest Browse all 3160

Trending Articles