Tải bản đầy đủ (.ppt) (11 trang)

Bài giảng Cơ sở dữ liệu nâng cao Chapter 6 Data replication

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (321.43 KB, 11 trang )

Data Replication


Overview of Replication
 SQL Server replication is a set of technologies for:
 copying and distributing data and database objects
from one database to another.
 Then, synchronizing between databases to maintain
consistency.
 Types of replication:
 Snapshot replication.
 Transactional replication
 Merge replication
 Peer – to – peer replication
 Oracle Publishing replication

 All of these types rely on a number of standalone

programs – agents.


Replication Scenario
 Replication is analogous to the publishing industry
 Article:
 a database object that you want to replicate; it can be a

Table, View, or Store procedure, or other objects.

 Publication:
 A collection of articles.
 One article can be in one or more publications.


 Publication can be treated as a logical grouping for the
articles
 For example: To replicate only the employee master
data, you can include employee table article, address
article, and any other relevant views to the publication


Replication Scenario
 Subscription:
 A request for a copy from the publication.
 Define where to receive the publication, what the
frequency for the receiving is, …
 Publisher
 A database instance that holds publications for other

database instances to receive.
 There can be several different types of publication in
one publisher.


Replication Scenario

 Distributor:
 Each publisher has a distributor to store replication
status data, and metadata about the publication.
 Sometimes the distributor acts as a data queue for data
moving from the publisher to the subscribers and vice
versa.
 There are two types of distributors:




local and remote.
Local distributor is where the publisher and distributor are in
one database server instance.

 Subscriber:
 A database instance that receives replicated data from
the publisher.
 In some replication types the subscriber also passes
data to the publisher.


Replication Types
 Snapshot:
 Distribute data as it appears in the publisher at a
specific moment of time. Whenever the Subscriber
called for subscription, it will send the snapshot of the
current Publisher and send it to the Subscribers.
 Limitations for using Snapshot Replication:




Replicating a small volume of data.
Infrequently changing data
Snapshot replication does not require primary article tables


Replication Types

 Components in Snapshot Replication:
 Two agents are used in Snapshot Replication, snapshot
and distribution.
 Snapshot Agent:





A shared agent for all replication types.
The snapshot agent’s job is to generate data scripts for the
objects you are replicating.
These scripts are written to a folder in the file system called a
snapshot folder.

 Distribution Agent:


This agent will read from a snapshot folder and distribution
database to propagate to the subscriber end.


Replication Types
 Transactional:
 The most used replication type
 The most valuable feature of the transactional
replication is the ability to replicate incremental
changes rather than applying the all-data set.
 Use transactional log to generate transactions for
replication.

 Here are the scenarios where you can use transactional
replication:




Replicate huge volumes of data
For real-time application
Replicate data between non-SQL Server databases


Replication Types
 Transactional:
 The most used replication type
 The most valuable feature of the transactional
replication is the ability to replicate incremental
changes rather than applying the all-data set.
 Use transactional log to generate transactions for
replication.
 Here are the scenarios where you can use transactional
replication:




Replicate huge volumes of data
For real-time application
Replicate data between non-SQL Server databases



Replication Types
 Peer-to-Peer Replication
 Peer-to-peer replication is an option with transactional
replication
 All nodes in a peer-to-peer replication topology
subscribe and publish from and to all other nodes. A
transaction originating at one node will be replicated to
all other nodes, but not replicated back to originator.
 This replication model is intended for use in
applications to have multiple databases or database
servers participating in a scale-out solution.


Replication Types
 Merge Replication
 Start from the initial snapshot. Afterward, changes at
both publisher and subscriber(s) are tracked with
triggers.
 Subsequent data changes and schema modifications
made at the Publisher and Subscribers are tracked with
triggers.
 The Subscriber synchronizes with the Publisher when
connected to the network and exchanges all rows that
have changed between the Publisher and Subscriber
since the last time synchronization occurred.



×