Download presentation
Presentation is loading. Please wait.
Published byShannon Woods Modified over 9 years ago
1
Module 2: Creating Efficient Replication Solutions
2
Overview Understanding the SQL Server Platform for Replication Replicating Data and Objects Replicating Data and Executing Objects Designing a Replication Topology Troubleshooting a Replication Implementation
3
Lesson: Understanding the SQL Server Platform for Replication Understanding Operating System Implications for Replication Understanding SQL Server Installation Implications for Replication
4
Understanding Operating System Implications for Replication Operating systems that CAN be used for transactional replication Publisher Operating systems that CANNOT be used for transactional replication Publisher Windows NT Windows 95 Windows 2000 Windows 98 Windows XP Windows Me, Windows CE
5
Understanding SQL Server Installation Implications for Replication Licensing Licensing requirements detailed on www.microsoft.com Character Sets All servers should use the same character set Collation Use the same collation at Publisher and Subscriber Sort order You may use different sort orders at Publisher and Subscriber
6
Lesson: Replicating Data and Objects Replicating Table Schema Planning to Publish Table Schema Objects Replicating Filtered Data Replicating Schema Objects – Views, UDFs, and Stored Procedures
7
Replicating Table Schema Schema changes required by replication Adding tables to track and manage replication Adding columns to identify records You can change the name of the destination table or its columns Changing columns sp_repladdcolumn sp_repldropcolumn On-demand script execution SQL Distributed Management Objects The publication property page Restrictions on dropping columns
8
Planning to Publish Table Schema Objects Primary key constraints Reference constraints Unique constraints Clustered and nonclustered indexes User triggers Extended properties Collation
9
Replicating Filtered Data Vertical Filtering 2 3 4 5 6 7 1 ABCDEF 2 3 4 5 6 7 1 ABE Table A Horizontal Filtering 2 3 4 5 6 7 1 ABCDEF 3 6 2 ABCDEF Table B Subscriber Publisher
10
These Objects Rely on These Tables Replicating Schema Objects – Views, UDFs, and Stored Procedures CREATE VIEW vw_EmployeeDept AS... CREATE FUNCTION fn_PayPeriod AS... CREATE VIEW vw_EmployeeDept AS... CREATE FUNCTION fn_PayPeriod AS... CREATE PROCEDURE pr_ValidateVac AS... Replicate View, UDF, Stored Procedures REPLICATED SEPARATELY Replicate View, UDF, Stored Procedures REPLICATED SEPARATELY Replicate Tables 1 1 3 3 2 2
11
Lesson: Replicating and Executing Objects Reducing Replication Volume with Stored Procedures Replicating Indexed Views as Tables Replicating with On-Demand Script Execution Preventing Data Inconsistencies from the Execution of Stored Procedures
12
Reducing Replication Volume with Stored Procedures UPDATE 200,000 Rows The execution of stored procedures UPDATE 200,000 Rows Create stored procedure to update affected rows 11 Publish the stored procedure; replication creates copies on each Subscriber 22 Execute the stored procedure on the Publisher 33 EXEC command is replicated 44 Update runs locally on Subscribers 55 1 1 3 3 2 2
13
Replicating Indexed Views as Tables Preserve the image of the view data on disk Allow you to replicate view content instead of schema Reduce the amount of data to be replicated
14
Replicating with On-Demand Script Execution Script execution uses osql.exe Script is replicated 11 Script executes locally 22 22 22 1 1 3 3 2 2 Truncate Table Truncate Table Truncate Table Truncate Table Truncate Table Truncate Table Truncate Table Truncate Table
15
Subscriber Publisher EXEC pr_Update Preventing Data Inconsistencies from the Execution of Stored Procedures UPDATE Table 1 UPDATE Table 2 Table 1 Table 2 EXEC pr_Update UPDATE Table 1 Table 1 UPDATE Table 2 Table 2 Publisher and Subscriber do not match Constraint Violation 1 1 3 3 2 2 Table 2 Constraint Violation
16
Lesson: Designing a Replication Topology Central Publisher and Distributor Republisher for a Slow Link Republisher for Scale Out Central Subscriber with Partitioned Data Bidirectional Partitioned Topology Bidirectional Non-Partitioned Topology
17
Central Publisher and Distributor Moscow Rome Paris Athens London Berlin headquarters Central Publisher and Distributor Remote Distribution 1 1 3 3 2 2 Central Publisher and Distributor
18
Republisher for a Slow Link Seattle San Francisco Dallas Sydney Hong Kong Beijing Tokyo San Francisco publishes to Seattle, Dallas, and Tokyo Slow link Tokyo republishes to Beijing, Hong Kong, and Sydney 1 1 3 3 2 2
19
Republisher for Scale Out London Dakar Worldwide Headquarters Rome European Headquarters New York Atlanta North American Headquarters Caracas Madrid
20
Central Subscriber with Partitioned Data Seattle New York San Francisco Dallas headquarters Mexico City
21
Bidirectional Partitioned Topology New York The New York Office updates customers in the East Region No conflicts exist The San Francisco Office updates customers in the West Region San Francisco 1 2 3 4 5 6 7 ABCDEF
22
Bidirectional Non-Partitioned Topology New York Both offices update the same data San Francisco 1 2 3 4 5 6 7 ABCDEF 1 1 3 3 2 2
23
Lesson: Troubleshooting a Replication Implementation Keep a Performance Baseline Check Replication Alerts Look for Errors by Using Replication Monitor Confirm Mutual Recognition of Servers Validate Data Check Subscription Status Restore the Subscriber to the Current State Removing Replication
24
Step 1: Keep a Performance Baseline
25
Step 2: Check Replication Alerts Default Alerts Agent success Agent failure Agent retry Subscriber has passed data validation Subscription cleaned up Subscriber has failed data validation Subscription reinitialized after data validation
26
Step 3: Look for Errors by Using Replication Monitor
27
Step 4: Confirm Mutual Recognition of Servers
28
Step 5: Validate Data Validation Options Compute a fast row count Compute an actual row count Compute a checksum Use stored procedures to validate a subscription sp_article_validation sp_publication_validation sp_table_validation Handling validation failures
29
Practice: Validate Data Subscribe to a publication Create an invalid row Validate data and receive error message
30
Step 6: Check Subscription Status sp_helppublication Information about all publications sp_helparticle Information about all articles sp_helpsubscription Information about all subscriptions
31
Step 7: Restore the Subscriber to the Current StateSynchronizeSynchronize Yes No Yes No Fixed?Fixed? Force replication Fixed? ReinitializeReinitialize CompleteComplete
32
Removing Replication Removal Sequence Stop the SQL Server Agent Remove replication with wizard Delete the distribution database Delete the Subscriber tables PreparationPreparation Create Scripts Create Scripts
33
Review Understanding the SQL Server Platform for Replication Replicating Data and Objects Replicating Data and Executing Objects Designing a Replication Topology Troubleshooting a Replication Implementation
34
Lab 2: Implementing Replication Exercise 1: Determining the Replication Type Exercise 2: Implementing Snapshot Replication Exercise 3: Implementing Transactional Replication Exercise 4: Implementing Merge Replication Exercise 5: Removing Subscriptions and Publications
35
Lab 2, exercise 1 – Determine the Topology Type Regional Office Mexico City Local Offices Regional Offices Regional Office Boston Regional Office Los Angeles Headquarters St. Louis Regional Office Atlanta Regional Office Chicago
36
Regional Office Mexico City Local Offices Regional Offices Regional Office Boston Regional Office Los Angeles Headquarters St. Louis Regional Office Atlanta Regional Office Chicago Lab 2, exercise 1 – Determine the Topology Type
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.