module 11: introducing replication. overview introduction to distributed data introduction to sql...
TRANSCRIPT
Module 11: Introducing Replication
Overview
Introduction to Distributed Data
Introduction to SQL Server Replication
SQL Server Replication Agents
SQL Server Replication Types
Physical Replication Models
Introduction to Distributed Data
The Need for Distributed Data
Considerations for Distributing Data
Methods to Distribute Data
The Need for Distributed Data
Brings Data Closer to the User
Allows Site Independence
Separates
Online transaction processing
Read-intensive applications
Can Reduce Conflicts
Considerations for Distributing Data
Factors
Timing/Latency
Site Autonomy
Transactional Consistency
ReplicationReplicationReplicationReplication
UPDATE
Distributed TransactionsDistributed TransactionsDistributed TransactionsDistributed Transactions
UPDATE UPDATE
Methods to Distribute Data
Snapshot Replication
Transactional Replication
Snapshot Replication with Immediate or Queued Updating Subscriptions
Transactional Replication with Immediate or Queued
Updating Subscriptions
Distributed Transactions
Lower AutonomyLower Latency
Lower AutonomyLower Latency
Higher AutonomyHigher Latency
Higher AutonomyHigher Latency
Merge Replication
Introduction to SQL Server Replication
The Publisher-Subscriber Metaphor
Publications and Articles
Filtering Data
Subscriptions
The Publisher-Subscriber Metaphor
PublisherPublisherPublisherPublisher
Maintains source databases
Makes data available for replication
DistributorDistributorDistributorDistributor
Receives data changes
Stores metadata, history, and receives and stores changes
May forward changes to subscribers
Holds copy of data
SubscriberSubscriberSubscriberSubscriber
Publications and Articles
Publication The basis of a subscription A collection of one or more articles Can have one or more publications per database
Article
Data from a whole or filtered partition of a table or a database object
Part of a publication
Filtering Data
Subscriber
Vertical Filtering
Horizontal Filtering
234567
1A B C D E F
234567
1A B C D E F
234567
1A B E
36
2A B C D E F
Table A
Table B Publisher
Subscriptions
Subscriber 3Subscriber 3Subscriber 3Subscriber 3
Push Subscription
Push Subscription
Push Subscription
Push SubscriptionPublication BPublication BPublication BPublication B
Subscriber 2Subscriber 2Subscriber 2Subscriber 2
Push Subscription
Push Subscription
Push Subscription
Push SubscriptionSubscriber 1Subscriber 1Subscriber 1Subscriber 1
Push SubscriptionPush SubscriptionPush SubscriptionPush Subscription
Publication APublication APublication APublication A
Pull SubscriptionPull SubscriptionPull SubscriptionPull Subscription
SQL Server Replication Agents
Snapshot Agent
Prepares initial snapshots and stores them on the distributor Distribution Agent
Moves snapshot and transactional data to Subscribers Log Reader Agent
Copies data from transaction log to the distribution database Merge Agent
Merges changes from multiple sites Queue Reader Agent
Applies changes from a queue and applies them to multiple subscribers
SQL Server Replication Types
Overview of the Replication Types
Considerations for Using Merge Replication
Overview of the Replication Types
Snapshot Replication
Periodic bulk transfer of new snapshots of data
Transactional Replication
Replication of incremental changes
Merge Replication
Autonomous changes to replicated data are later merged
Considerations for Using Merge Replication
Changes to the Schema
Identifies a unique column Adds several system tables Creates triggers at Publisher and Subscriber
Conflict Resolution
Tracks updates Compares values and resolves conflicts Replicates only synchronized data
Physical Replication Models
Overview of the Physical Replication Models
Combining Physical Replication Models and Types
Central Publisher/Remote Distributor Example
Central Subscriber/Multiple Publishers Example
Multiple Publishers/Multiple Subscribers Example
Overview of the Physical Replication Models
Central Subscriber/Multiple PublishersCentral Subscriber/Multiple PublishersCentral Subscriber/Multiple PublishersCentral Subscriber/Multiple Publishers
Publisher/Distributor
SubscriberPublisher/Distributor
Publisher/Distributor
Publisher/Distributor
Multiple Publishers/Multiple SubscribersMultiple Publishers/Multiple SubscribersMultiple Publishers/Multiple SubscribersMultiple Publishers/Multiple Subscribers
Publisher/Distributor/Subscriber
Publisher/Distributor/Subscriber
Publisher/Distributor/Subscriber
Subscribers
Publisher/Distributor
Central Publisher/DistributorCentral Publisher/DistributorCentral Publisher/DistributorCentral Publisher/Distributor
Combining Physical Replication Models and Types
The Model Is the Physical Implementation
The Type Provides the Functionality
Any of the Models Can Use Any of the Types
Central Publisher/Remote Distributor Example
New York
Publisher
London
Subscribers
Rome
Paris
Dublin
RemoteDistributor
Central Subscriber/Multiple Publishers Example
RRegion1 Ordersegion1 OrdersRRegion1 Ordersegion1 OrdersPrimary KeyPrimary Key
Reg_codeReg_code IdId Order_noOrder_no
1 1
1 1
10003100
10003100
~~
~~
QtyQty
1522
1522
RRegion2egion2 Orders OrdersRRegion2egion2 Orders OrdersPrimary KeyPrimary Key
Reg_codeReg_code IdId Order_noOrder_no
2 2
2 2
10002380
10002380
~~
~~
QtyQty
328
328
RRegion4 Ordersegion4 OrdersRRegion4 Ordersegion4 OrdersPrimary KeyPrimary Key
Reg_codeReg_code IdId Order_noOrder_no
4 4
4 4
10002000
10002000
~~
~~
QtyQty
4330
4330
RRegion3 egion3 OrdersOrdersRRegion3 egion3 OrdersOrdersPrimary KeyPrimary Key
Reg_codeReg_code IdId Order_noOrder_no
3 3
3 3
10001070
10001070
~~
~~
QtyQty
719
719
Publisher
Publisher
Publisher
Publisher Subscriber
MasterMaster O OrdersrdersMasterMaster O OrdersrdersPrimary KeyPrimary Key
Reg_codeReg_code IdId Order_noOrder_no
1 1 2 2 3 3 4 4
1 1 2 2 3 3 4 4
10003100100023801000107010002000
10003100100023801000107010002000
~~~~~~~~
~~~~~~~~
QtyQty
1 1 2 2 3 3 4 4
1 1 2 2 3 3 4 4
11
10003100
~~
1522
22
10002380
~~
328
33
10001070
~~
719
44
10002000
~~
4330
Multiple Publishers/Multiple Subscribers Example
OOrders rders (Shop A)(Shop A)OOrders rders (Shop A)(Shop A)Primary KeyPrimary Key
AreaArea IdId Order_noOrder_no
1 12233
1 12233
100031001000238010001070
100031001000238010001070
~~~~~~
~~~~~~
QtyQty
15223287
19
15223287
19
11
10003100
~~
1522
OOrders rders (Shop B)(Shop B)OOrders rders (Shop B)(Shop B)Primary KeyPrimary Key
AreaArea IdId Order_noOrder_no
112233
112233
100031001000238010001070
100031001000238010001070
~~~~~~
~~~~~~
QtyQty
15223287
19
15223287
19
22
10002380
~~
328
OOrders rders (Shop C)(Shop C)OOrders rders (Shop C)(Shop C)Primary KeyPrimary Key
AreaArea IdId Order_noOrder_no
112233
112233
100031001000238010001070
100031001000238010001070
~~~~~~
~~~~~~
QtyQty
15223287
19
15223287
19
33
33
10001070
10001070
~~
~~
719
719
Publisher/Subscriber
Publisher/SubscriberPublisher/Subscriber
Recommended Practices
Determine the Acceptable Degree of Data LatencyDetermine the Acceptable Degree of Data Latency
Select an Appropriate Replication TypeSelect an Appropriate Replication Type
Select the Physical Replication ModelSelect the Physical Replication Model
Determine Whether to Allow Updates to Replicated DataDetermine Whether to Allow Updates to Replicated Data
Lab A: Implementing Replication
Review
Introduction to Distributed Data
Introduction to SQL Server Replication
SQL Server Replication Agents
SQL Server Replication Types
Physical Replication Models