Skip to main content

SQL Server Replication Overview

For my next series of blog posts I intend to document and write about SQL Server replication. This is a pretty large topic and I make no claims to an expert in replication but over the last couple years I have been working with replication more and more and I think it is time I wrote some blog posts on the topic to document and reinforce my understanding of the subject and  hopefully learn a lot along the way.


SQL Server replication is a technology  that can be used to  distribute and update data from one database to another and also synchronising the databases to maintain consistency.


SQL Server offers the following types of Replication:

Snapshot Replication - a snapshot of the database is taken at a point in time and the whole data set it rather than individual transactions is applied to the subscriber. This is not a continuous process so the subscribing database always has some latency when compared to the publishing database.

Transactional Replication - Transactional replication allows incremental changes to be applied to the subscribing databases. These changes can either be applied continuously or incrementally - at set intervals. Transactional replication is normally used when there is high number of write transactions against the database (INSERT, UDPATED, DELETE)

Merge Replication - I struggled to put merge replication in to words but Book Online describes it as "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 synchronisation occurred." I think Merge replication is probably the most complicated and difficult type of replication to configure and manage.

The type of replication you choose for a given application will vary according to a number of factors. This MSDN article http://msdn.microsoft.com/en-us/library/ms152565.aspx details what type of replication is best suited for a given scenario.

I have worked mainly with snapshot and transaction replication so I will start with some posts on how to configure these two type of replication. I have not done much with merge replication in truth, but I will be looking at it here too. All these will be in posts over the newt few weeks and  months  but for the purpose of this post I am going to explain some the  components of replication:

The Distributor - Can be generally thought of as the link between the components involved in replication. It plays a key role in 'distributing' data from the publisher to the subscribers

Publisher - The publisher is the source database that makes it components available to those wishing to subscribe to it. The Publisher is the data to be replicated.

Subscriber - stores the replicated data and received updates

Article – “is a grouping of data to replicated”

There are several agents that play a key role in replication, there are:

  • Snapshot Agent
  • Log Reader Agent
  • Queue Reader Agent
  • Distribution Agent
  • Merge Agent

These agents are standalone programs that play a key role in replication. By default they are run using the SQL Server agent. bare in mind that the SQL agent needs to be running for these jobs to run successfully.

Next we’ll be looking at configuring replication.

Comments

  1. Nice article - been meaning to get familiar with replication but usually trip all over the publisher/subscriber/distributor terms and then trying to figure out what's actually happening when it's running. Looking forward to next posts in the series.

    ReplyDelete

Post a Comment

Popular posts from this blog

Always Encrypted

By David Postlethwaite

Always Encrypted is new features in SQL Server 2016 and it is also available in Azure SQL Database. Here you can encrypt columns in a table with a master key and a certificate so that they will appear as encrypted strings to those who don’t have the required certificate installed on their pc.
Once the certificate is installed on the computer then the unencrypted data can then be seen as normal.

The data passes from database to your application as the encrypted value, only the application with the correct certificate can unencrypt the data so it is secure across the wire. This will go some way to resolving the concern of people worried about putting their sensitive data on a shared server in the cloud such as Microsoft Azure and accessing the data across the Internet.

At the time of writing Always Encrypted is only supported with ADO.NET 4.6, JDBC 6.0 and ODBC 13.1 but expect other driver to become available.

The calling application (including SSMS) must also hav…

SQL Server 2012 and Virtual Service Accounts

This post is written by David Postlethwaite
If you are using SQL Server 2012 you will probably have noticed that the default account for the SQL services has changed from that used in previous versions. With SQL 2005 and 2008 the default account for SQL service and SQL Agent service was “NT Authority\System”. This is one the built in accounts on a Windows machine, managed by the machine and selectable from a dedicated dropdown list

The Network Service account was introduced in Windows 2003 as an alternative to using the LocalSystem account, which has full local system privileges on the local machine, a major security concern.
The Network Service has limited local privileges easing these security concerns but when many services on a machine use the Network Service account it becomes harder to track which service is actually accessing resources and performing actions, because all the services are using the one Network Service account.
Also, this account, by default, has sysadmin per…

SQL Server Express v SQL Server Developer Edition

SQL Server Express v  SQL Server Developer Edition
Over the weekend I received the following in an email from Ali Ahmad who asked me some questions about learning SQL Server. We exchanged a couple of emails so I have boiled this down to the most salient points.

Question:
Goal: I want to learn SQL Server inside out… for career progression as DBA/BI/data mining. I'm a data analyst and want to learn inside out about data warehousing.
•I understand relational database concepts...
•I have SQL Server 2014 express installed…
•I need to download the adventure works sample in order to play with it.
•So much knowledge on Microsoft website it's easy to get lost… where do I begin?

SQL Server Express v SQL Server Developer
This is interesting. If you want to learn SQL Server inside out including the Business Intelligence suite of applications I would suggest downloading the developer edition of SQL Server which since 2016 has been made available free of charge. Prior to that there was a f…