Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is transactional replication used for?

What is transaction replication used? I seemed to create transaction replication following this tutorial:

http://www.sql-server-performance.com/2010/transactional-replication-2008-r2/

And I know when I change some objects i.e any DML or DDL statement, those changes will be reflected to the other server where I did replication. But it's not clear to me why should we use transaction replication. Does SQL server automatically start using the 2nd server where replication was done when the main instance fails? or do we have to manually restore the database from the server where replication was done in case of failure of 1st instance?

Thanks in advance :)

like image 535
Jack Avatar asked Apr 10 '12 09:04

Jack


1 Answers

You can use transactional replication to maintain a warm standby SQL server. Transactional replication replicates the data on one server (the publisher) to another server (the subscriber) with less latency than log shipping.

You can implement transactional replication at the database object level such as the table level. Therefore, Microsoft recommends that you use transactional replication when you have less data to protect, and you must have a fast data recovery plan.

This solution is vulnerable to the failure of the publisher and the subscriber at the same time. In such a scenario, you cannot protect your data. In all other scenarios such as the failure of a distributor or a subscriber, it is best to resynchronize the data in the subscriber with the data in the publisher.

You should use transactional replication to maintain a warm standby SQL server only when you do not implement schema changes or you do not implement other changes to your database such as security changes that replication does not support.

Note Replication is not designed for the maintenance of warm standby servers. With replication, you can use replicated data at the subscriber to generate reports. You can also use replication for other general uses without having to perform processing on your relatively busy publisher.

Disadvantages

  1. Schema changes or security changes that are performed at the publisher after establishing replication will not be available at the subscriber. The distributor in transactional replication uses an Open Database Connectivity (ODBC) connection or an OLE Database (OLEDB) connection to distribute data. However, log shipping uses the RESTORE TRANSACTION low-level Transact-SQL statement to distribute the transaction logs. A RESTORE TRANSACTION statement is much faster than an ODBC connection or an OLEDB connection.

  2. Typically, switching servers erases replication configurations. Therefore, you have to configure replication two times:
    a. When you switch to the subscriber.
    b. When you switch back to the publisher.

  3. If a disaster occurs, you must manually switch servers by redirecting all the applications to the subscriber.

Read more here http://sqlserverdatarecovery.com/transactional_replication.html

like image 186
Thakur Avatar answered Nov 16 '22 09:11

Thakur