16.3. Implementing Replication

With so much terminology involved, replication can be confusing and misleading initially. In this section, you'll go through an exercise to set up snapshot replication.

You shouldn't have trouble setting up snapshot replication. Transactional and merge replication is similar. We will review the major differences right after snapshot replication setup.

16.3.1. The Setup

To keep things simple, you will create two new databases in this replication example: a new database called Publisher that will be the publisher, and a new database called Subscriber that will be the subscriber. For the purposes of this example, you will create a sales schema, and in that schema create a single table, Cars. You will then insert a small set of rows into that table. The scenario is based on a car company that sells fuel-efficient hybrid cars in the United States, China, and Sweden. You'll set up snapshot replication between database servers in the U.S. and China to refresh data. Furthermore, you can set up transactional replication between database servers in the U.S. and Sweden. The data can also be used to set up merge replication. Use the following script to create the table and insert some relevant data:

-- Make sure we are in the Publisher database Use Publisher Go -- Create the new Sales schema Create Schema Sales Go -- Create the Cars table CREATE TABLE Sales.Cars (ProdID INT PRIMARY KEY, ProdDesc varchar(35), Country varchar(7), LastUpdate smalldatetime ) Go ...

Get Professional Microsoft® SQL Server® 2008 Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.