SQL Server: Is replication recovery model dependent?

Source: Internet
Author: User
Tags bulk insert

There is a myth that for replication to work properly the databases always have to be in full recovery mode. Well that is not at all true.

First let me give a short overview on how replication works.

A snapshot agent creates a snapshot of the publisher which is then taken up by the distributor agent to apply any schema changes. Log Reader Agent then replicates transaction to the distributor after reading the log records which
Are marked for a replication and the distributor agent replicates them over to the subscriber.

So now when a checkpoint occurs it will skip those records which are marked for replication. Once the distributor agent traverses the records to the subscriber the transaction which were before marked as "marked for replication"
Will be marked as "replicated" by the Log Reader Agent.

Now when the next checkpoint occurs these transactions will also be truncated. so it is not necessary that the recovery model always have to be in full recovery model for all this to happen. as logging is done even in simple recovery
Mode and maintained until the next checkpoint occurs.

But you have to be careful when you are creating the following actions if your database is in simple recovery model and is part of replication as output of these actions will not be replicated

  • Create Index

  • Truncate table

  • BULK INSERT

  • BCP

  • Select...

The reason... well the replication engine will not be able to pick up these changes as these changes will only log page allocations and de-allocations. you wont have to worry about the schema changes as these changes will be
Replicated though they are in simple recovery model.

So the ideal strategy of recovery model for setting up a replication environment from my point of view wocould be

1) publisher database be in simple recovery mode.

2) Subscriber be in a full recovery mode.

Some people might argue that if publisher is set to simple then tlog backup wont be possible.

Well tlog backup on the publisher wont be of any use anyways in full recovery model because log backup's wont cover the records until they are marked as "marked or replication" I. E records which still haven'tbeen replicated
The subscribers.

So it is better to have subscriber in full recovery model and set up tlog backups over there which can save a lot of log space on the publisher.

 

From: http://www.sqlservergeeks.com/blogs/Sachin.Nandanwar/sql-server-bi/135/sql-server-is-replication-recovery-model-dependent

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.