Transactional Replication A Deeper Dive Drew Furgiuele, Senior DBA IGS

Slides:



Advertisements
Similar presentations
Mecanismos de alta disponibilidad con Microsoft SQL Server 2008 Por: ISC Lenin López Fernández de Lara.
Advertisements

SQL Server Replication
Moving data using replication Anthony Brown
Adam Thurgar Database Consultant AiT Consultancy Replication with SQL Server ™ – Lessons from the Real World.
Module 4: Implementing Transactional Replication.
SQL Server 2008 for Developers John
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Module 2: Creating Efficient Replication Solutions.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Overview – Chapter 11 SQL 710 Overview of Replication
Module 6: Implementing SQL Server Replication in an Enterprise Environment.
1 Chapter Overview Introducing Replication Planning for Replication Implementing Replication Monitoring and Administering Replication.
Module 11: Introducing Replication. Overview Introduction to Distributed Data Introduction to SQL Server Replication SQL Server Replication Agents SQL.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
DAT 412:Transactional Replication Internals
 Replication is the process of copying database information  Replication is used for:  Backing up your database  Migrating to a new server  Mirroring.
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
CHANGE DATA CAPTURE: A BRIEF OVERVIEW PRESENTED BY TIM WEIGEL
Module 5: Implementing Merge Replication. Overview Understanding Merge Replication Architecture Implementing Conflict Resolution Planning and Deploying.
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
DATABASE REPLICATION DISTRIBUTED DATABASE. O VERVIEW Replication : process of copying and maintaining database object, in multiple database that make.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
Ch 12. Replication. Replication Place copies of data to a different location Use: Reduce locking conflict when multiple sites want to work on same set.
Migrating Data to SQL Azure Arunraj Chandrasekaran Twitter June 21, 2011.
IMS 4212: Constraints & Triggers 1 Dr. Lawrence West, Management Dept., University of Central Florida Stored Procedures in SQL Server.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
SQL Server Replication HILARY COTTER SQL SERVER MVP
Transactional Replication it’s not scary Evgeny Khabarov.
Defense In Depth: Minimizing the Risk of SQL Injection
SQL Database Management
Backups for Azure SQL Databases and SQL Server instances running on Azure Virtual Machines Session on backup to Azure feature (manual and managed) in SQL.
DBMS Programs MS SQL Server & MySQL
SQL Replication for RCSQL Reporting
With Temporal Tables and More
Welcome POS Synchronize Concept 08 Sept 2015.
On-premise database. Files in the cloud.
SQL Replication for RCSQL 4.5
Transactional Replication Deep Dive
Distributed Database Management Systems
Tables and Triggers.
Glasgow, SQL Server Meetup
Disaster Recovery Where to Begin
Lead SQL BankofAmerica Blog: SQLHarry.com
Getting Started With SQL Server Replication
Transactional replication
Introduction to Replication
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Designing an alternative to Replication
Isolation Levels Understanding Transaction Temper Tantrums
DevOps Database Administration
SQL Server and PowerShell Let’s Get Serious
Help! My Replication Has Fallen and We Can't Get it Replicating again
In-Memory OLTP (IMOLTP) What Can It Do For Me?
SQL Server and PowerShell Let’s Get Serious
How to keep your database servers out of the news Matt Gordon
DevOps Database Administration
SQL Server and PowerShell Let’s Get Serious
Informix Dynamic Server Continuous Availability Feature (CAF)
Prove to your boss your database is sound - Unit Testing with tSQLt
Migrating your SQL Server Instance
SQL Server and PowerShell Let’s Get Serious
Cloud Data Replication with SQL Data Sync
Understanding Transaction Isolation Levels
PowerShell & PowerBi Reducing DBAs Context Switching
AlwaysOn Availability Groups
Governing Your Enterprise with Policy-Based Management
Michelle Haarhues Keeping up with SSMS.
Presentation transcript:

Transactional Replication A Deeper Dive Drew Furgiuele, Senior DBA IGS Don’t forget to delete extended event files and start new sessions Delete XEL files Destroy publications Destroy subscriptions Disable publishing and distribution Destroy SQL Database in Azure Run initial objects script Enable server A and B as publishers on the distributor Start snapshots Open: https://msdn.microsoft.com/en-us/library/ms146878.aspx https://msdn.microsoft.com/en-us/library/ms147328.aspx https://msdn.microsoft.com/en-us/library/ms146939.aspx 11/7/2018

About me Contact Info I’m a Senior SQL Server DBA at IGS Energy in Dublin, Ohio. I’ve been using SQL Server since SQL Server 2000 and I love it. I also enjoy DevOps, release management, and PowerShell. dfurgiuele@igsenergy.com @pittfurg http://www.port1433.com http://www.genesface.com 11/7/2018

What’s In This Presentation? How transactional replication works Security model Monitoring and querying (Some) Knobs and levers “Problem areas” Replication and HA

When Should You Consider Transactional Replication? Reporting instances Concurrent copies of data Migrating data to Azure?

When You SHOULDN’T Consider (Any) Replication As a DR practice As a real-time source of data

Transactional Replication Distribution Agent Responsible for applying initial snapshot, and applying transactions at the subscriptions Snapshot Agent Subscriber Publisher Snapshot Folder Log Reader Agent Scans the transaction log of the published database for changes and logs them to the distribution database Distribution Database Holds pending transactions to be applied to the subscriber

Security and Permissions For snapshot agents: db_owner on published database(s), db_owner on the distribution database, and read/write permissions on the network snapshot share. For distribution agents: db_owner on distribution, db_owner on subscriber database, and read access to the snapshot network share. For log reader agents: db_owner in both distribution database and published database(s). You can also impersonate the SQL Agent account, but it’s not best practice. More best practices for replication security: https://msdn.microsoft.com/en-us/library/ms151227(v=sql.110).aspx

What happens when a transaction is replicated? What gets replicated? Monitoring transactions When is a statement not a statement? Your transaction will be multiple statements Different behaviors are possible Inserts and updates are always passed down the chain Same for DML statements Updates only go IF the a value changed Talk about CALL methods CALL (default for inserts and deletes) passes in all columns to be inserted into a table, or just the primary key columns for deletes SCALL (default for updates) passes all changed column values, the primary key column(s) for update, and a bitmask for the changed columns MCALL same as SCALL, but all columns come with the procedure call XCALL passes all original values along with the changed values Show the differences in extended events

Let’s replicate some transactions!

Common Trouble Spots Snapshots and objects Distribution cleanup jobs Replication and continuous integration Transactions that break replication

Things to remember when something is replicated… Truncate table Renaming objects Object dependencies Changing data at a subscriber?

What To Do When It Breaks Is replication actually doing anything? The replication monitor What’s that red “X” mean DR and replicated databases Job Agent Alerts Show things that break… dropping a column that is needed by an index. Also, schema-bound views. What happens if a row doesn’t exist? Mention SQL Server versions and column types (like geography). Show stopping the sync, how transactions have to roll back. Talk about batching updates.

Replication and HA Bad news first: you can’t put the distribution database into an availability group But you can replicate databases that are in an availability groups Show how the set up works Show what happens if you don’t redirect to the listener Show how transaction still don’t deliver if a secondary is offline

Replication and HA, continued Just make sure: Add all nodes as a publisher at the distributor Enable replication on all databases on the other nodes manually with TSQL Additional permissions for the agents Consider TF 1448?

Monitoring Latency You can use replication monitor You can use TSQL You can even use PowerShell! TSQL sp_browsereplcmds : @xact_seqno_start, @xact_seqno_end

Replication and TDE Does replication “break” TDE? Remember: By default, NOTHING in replication is encrypted! You can enable SSL communication in the agent profile. BCP files are NOT encrypted! Your publisher replication is not a guarantee of replication at a subscriber. bcp Uhoh.dbo.Password IN Password_2#1.bcp -T -C

Would you like to know more? MSDN: https://msdn.microsoft.com/en-us/library/ms151198.aspx SQL Server Central: http://www.sqlservercentral.com/stairway/72401/ More on SQL Server Replication To Azure SQL Database: https://msdn.microsoft.com/library/mt589530.aspx

Questions?

About me Contact Info I’m a Senior SQL Server DBA at IGS Energy in Dublin, Ohio. I’ve been using SQL Server since SQL Server 2000 and I love it. I also enjoy DevOps, release management, and PowerShell. dfurgiuele@igsenergy.com @pittfurg http://www.port1433.com http://www.genesface.com 11/7/2018