Download presentation
Presentation is loading. Please wait.
1
Transactional Replication Deep Dive
Kendal Van Dyke Senior DBA, Channel Intelligence Inc. Transactional Replication Deep Dive
2
Agenda General Concepts How It Works Advanced Options Monitoring
Troubleshooting Q&A
3
General Concepts Publisher Article Publication Subscriber Distributor
Source of data to be replicated to other servers Article Table, View, UDF, or Procedure to be replicated Publication Collection of articles in a database to be published Subscriber Server which receives replicated data Distributor Stores all data changes to be replicated between publishers and subscribers in a distribution database Snapshot Point-in-time copy of the schema and data for a publication Agent Performs replication related tasks (e.g.delivering changes to subscribers)
4
How It Works
5
How It Works
6
Advanced Options Publications
Articles can be configured to determine how they will look at subscribers Filtering Articles in a publication can be filtered vertically (columns) and horizontally (rows) Horizontal filters can include join criteria Filtering on datetime not recommended – data is not automatically deleted from subscribers Every transaction must still be examined by Log Reader Agent
7
Advanced Options Publications DDL changes replicated by default
Default synchronization method in 2005 is concurrent Does not lock tables while taking snapshot Replicating SPs and UDFs replicates execution. Use snapshot publication to replicate the schema Replicating Views requires that the base tables exist Possible to replicate Indexed Views as a table, but not through UI
8
Advanced Options Subscriptions Can be push or pull
Push = distribution agent runs on distributor Pull = distribution agent runs on subscriber Subscriptions can be created without synchronization Use sp_scriptpublicationcustomprocs to generate stored procedures for publication
9
Advanced Options Agents
Use independent agents instead of shared agents for multiple publications on the same publisher Set agents to run continuously instead of on a schedule Less latency, less overhead because processes are not stopping\starting constantly Agent profiles allow each agent to be customized Distribution Agent -BcpBatchSize Number of rows to send in a bulk copy operation (default 1000) -CommitBatchSize Number of transactions sent to subscriber before COMMIT (default 100) -CommitBatchThreshold Number of commands sent to subscriber before COMMIT (default 1000)
10
Monitoring Replication Monitor works well, but not perfect
System Stored Procedures sp_helppublication = 'publication' sp_helpdistributor sp_helpsubscriberinfo sp_helpsubscription sp_replcounters = 'publication' Perfmon counters SQLServer: Replication Agents SQLServer: Replication Dist. SQLServer: Replication Logreader SQLServer: Replication Snapshot Alerts
11
Troubleshooting Error: “The row was not found at the Subscriber when applying the replicated command” Use “Continue on data consistency errors.” System Profile for distribution agent Sets “-SkipErrors” to “2601:2627:20598” OR Look at error in distribution agent history to obtain transaction sequence number and command ID Use sp_browsereplcmds to view commands in distribution database Delete bad command from MSrepl_commands Error: “Could not find stored procedure 'sp_MSins_blahblahblah“ Replication stored procedure missing at subscriber Use sp_scriptpublicationcustomprocs to generate stored procedures for publication
12
Troubleshooting Distribution agents won't start or don't appear to do anything Possible issue with non-interactive desktop heap Requires registry change Microsoft KB article Snapshot agent cannot complete or distribution agents frequently retry Possible network issue – check speed and duplex on network cards All subscriptions show the same latency value Log Reader Agent may be behind. Use DBCC commands to view transaction log on publisher DBCC SQLPERF(logspace) DBCC LOGINFO Delete commands replicate, even though they were set not to Management Studio UI bug Script publication, = N’NONE’
13
Thank you! Questions? kendal.vandyke@gmail.com
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.