How to synchronize two (or n) replication processes for MS SQL databases?
- by Yauheni Sivukha
There are two master databases and two read-only copies updated by standard transactional replication. It is needed to map some entity from both read-only databases, lets say that A databases contains orders and B databases contains lines.
The problem is that replication to one database can lag behind replication of second database, and at the moment of mapping R-databases will have inconsistent data. For example.
We stored 2 orders with lines at 19:00 and 19:03. Mapping process started at 19:05, but to the moment of mapping A database replication processed all changes up to 19:03, but B database replication processed only changes up to 19:00. After mapping we will have order entity with order as of 19:03 and lines as of 19:00. The troubles are guaranteed:)
In my particular case both databases have temporal model, so it is possible to fetch data for every time slice, but the problem is to identify time of latest replication.
Question: How to synchronize replication processes for several databases to avoid situation described above?