It is often necessary to synchronize data from the main tables in one database in order to clone tables in other databases, often on other servers. For example, consider the case where the backend system manages the inventory data and that the inventory data must ultimately be transferred to one or more databases that are part of the website application.
The source data in the backend system is very normal, with dozens of tables and foreign key constraints. This is a well-established OLTP RDBMS system. Many of the tables in question contain millions of rows. You must regularly distribute this data to other databases. As often as possible; latency may be allowed. First of all, the maximum runtime of both the backend and remote databases is extremely important.
I am using SQL Server and are familiar with change tracking, rowversion, triggers, etc. I know that Microsoft strongly encourages replication, SyncFx and SSIS for these scenarios. However, there is a big difference between vendor documents and reviews recommending technology, as well as the actual implementation, deployment, and maintenance of the solution. In the SQL Server world, replication is often seen as a turnkey solution, but I'm trying to explore alternative solutions. (There is some concern that replication is difficult to administer, makes schema changes difficult, and if reinitialization is required, there will be a lot of room for critical systems.)
There are a lot of mistakes. Due to the complex foreign key relationships between a large number of tables, determining which order to capture or apply updates is not trivial. Due to the unique indexes, two rows can be blocked in such a way that updating by row will not work (it is necessary to perform intermediate updates for each row until the final update). These are not necessarily show stoppers, since unique indexes can often be changed to regular indexes, and foreign keys can be disabled (although disabling foreign keys is highly undesirable). You will often hear “simple” using SQL 2008 change tracking and SSIS or SyncFx. Such answers really do not justify practical difficulties. (And, of course, customers really have a difficult time wrapping their heads around how copying data can be so complicated that it makes the difficult situation even worse!)
This problem is ultimately very versatile: do one-way synchronization of many heavily loaded database tables with lots of rows. Almost everyone who deals with databases is dealing with such a problem. Documents distributed, practical experience difficult to find. We know that this can be a difficult problem, but work must be done. Let me hear about what worked for you (and what to avoid). Tell us about your experiences with Microsoft products or products from other vendors. But if you have not personally tested the battle with a large number of closely related tables and rows, please refrain from answering. Let it be practical - not theoretical.
sql database sql-server data-synchronization
Jason kresowaty
source share