简体   繁体   English

没有主键的SQL Server上的事务复制

[英]Transactional replication on SQL server without primary key

We are implementing a snapshot replication on our current system Lately, the system require us to apply the "instant replication" (require the low latency between articles on Publisher and Subscriber) 我们正在当前的系统上实现快照复制。最近,系统要求我们应用“即时复制”(要求Publisher和Subscriber上的文章之间的等待时间短)

Unfortunately, the tables on Publisher have not Primary key (but they have some unique index). 不幸的是,Publisher上的表没有主键(但是它们具有一些唯一的索引)。 The database on Publisher is not on our control, that means we are not allowed to change the schema of the database ( add primary key or add column) Publisher上的数据库不在我们的控制之下,这意味着我们不允许更改数据库的架构(添加主键或添加列)

I cannot use Transactional Replication (due to no-primary key problem) or Merge Replication (due to the fact that Merge Replication automatically adds Guid column on our tables) 我不能使用事务复制(由于没有主键问题)或合并复制(由于合并复制会在我们的表上自动添加Guid列)

I wonder if I have any way to resolve this problem ( we use Sql server 2012 Enterprise Edition on Publisher and Sql 2014 Web Edition on Subscriber) 我想知道是否有任何方法可以解决此问题(我们在发布服务器上使用Sql Server 2012企业版,在订阅服务器上使用Sql 2014 Web版)

Implementing Replication without the primary keys leave you with the only option of Merge Replication. 在没有主键的情况下实施复制使您只能选择“合并复制”。

As you correctly mentioned Merge replication will add a guid column to all the tables, unfortunately there is no way around to it unless you add a Dummy primary key column where primary is missing. 正如您正确提到的那样,合并复制将为所有表添加一个guid列,不幸的是,除非您在缺少主键的地方添加了一个Dummy主键列,否则无法解决。

All in all if replication is the only option and you have missing Primary keys, Merge Replication is the only type of replication you can implement. 总而言之,如果复制是唯一的选择,并且您缺少主键,则合并复制是您可以实现的唯一复制类型。 Else look into other options like Log shipping or Mirroring. 另外,还可以查看其他选项,例如日志传送或镜像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM