Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

731


Chapter 28: Replicating Data


28


■ (^) Peer-to-peer replication: Another variant of transactional replication used to rep-
licate data to one or more nodes. Each node can publish data to member nodes in
a peer-to-peer replication topology. Should one node go offl ine, changes occurring
on the offl ine node, and the other member servers will be synchronized when that
node comes back online. Changes are replicated bidirectionally, so a change occur-
ring on Node A replicates to Node B, and changes occurring on Node B replicate to
Node A. Peer-to-peer replication is an Enterprise Edition–only feature scalable to
approximately 10 nodes, but your results may vary depending on your replicated
workload, your hardware, and your available bandwidth.
■ Merge replication: As the name indicates, merge replication is used to merge
changes occurring on the destination server with changes occurring on the source
server, and vice versa. It is highly scalable to hundreds if not thousands of destina-
tion servers. With merge replication, there is a central clearinghouse for changes
that determines which changes go where. With peer-to-peer replication, any mem-
ber node in the topology can assume the clearinghouse role.
Replication Agents
As you might imagine, a lot of work is required to move data between the various servers
that are part of your replication environment. To do so, SQL Server replication makes use of
three agents:
■ (^) Snapshot agent: Generates the tabular and schema data or schemas for the objects
you want to replicate. The tables and schema data, and related replication meta-
data, is frequently referred to as the snapshot. The snapshot agent is used by all
replication types. The snapshot agent writes the tabular/schema data to the fi le
system. Snapshot and transactional replication can publish data to an ftp server.
Although this topology is not commonly used, it is a viable option for those that
need data replicated between different businesses and industries.
■ Distribution agent: Used by snapshot replication to apply the snapshot on the
subscribers, and used by transactional replication to apply the snapshot on the
subscriber and to replicate subsequent changes occurring on the publisher to the
subscriber. These changes can include both data and schema changes.
■ Merge agent: Detects changes that have occurred on the publisher and the sub-
scriber since the last time these agents ran and merges them together to form a
consistent set on both the publisher and the subscriber. In some cases, the same
primary key value will be assigned on the publisher and one or more subscribers
between runs of the merge agent (called a sync). When the merge agent runs, it
detects this confl ict and logs it to confl ict tables that can be viewed using the con-
fl ict viewer. With merge replication, the data in confl ict persists on the publisher
and the subscriber by default. For example, if a primary key value of 1,000 for a
table is assigned on the publisher, and then the same value is assigned on the same
table on the subscriber, when the merge agent runs, it logs the confl ict but keeps
c28.indd 731c28.indd 731 7/31/2012 9:51:11 AM7/31/2012 9:51:11 AM
http://www.it-ebooks.info

Free download pdf