简体   繁体   English

在Oracle数据库中使用触发器在表上进行2种复制

[英]2 way replication on tables with trigger in oracle database

what is the best way to replicate tables from oracle database on primary server to similar database on secondary server and vice versa. 将表从主服务器上的oracle数据库复制到辅助服务器上的类似数据库,反之亦然的最佳方法是什么? i have tried using oracle streams but issue is i have triggers on tables and my requirement is to replicate data from these tables to database on secondary server and vice versa.As soon as the data is inserted in tab1 of sourceDB same is updated in tab2 of destiDB also the trigger on tab1 of destieDB gets triggered .This triggers should not triggered 我已经尝试过使用oracle流,但是问题是我在表上有触发器,我的要求是将这些表中的数据复制到辅助服务器上的数据库中,反之亦然。一旦将数据插入到sourceDB的tab1中,则在tab2的tab2中进行更新destiDB也会触发destieDB的tab1上的触发器。不应触发此触发器。

basic idea being data availability. 基本思想是数据可用性。

Please suggest if this is correct way or i need to use some other way 请建议这是正确的方法还是我需要使用其他方法

You can use GoldenGate with SUPPRESSTRIGGERS option. 您可以将GoldenGate与SUPPRESSTRIGGERS选项一起使用。 But it depends on your oracle version (not working on 11.1). 但这取决于您的oracle版本(不适用于11.1)。

Adding DBOPTIONS SUPPRESSTRIGGERS to your replicat process configuration will prevent the trigger being executed on the target DB. DBOPTIONS SUPPRESSTRIGGERS添加到复制过程配置中将阻止在目标DB上执行触发器。

You could code the triggers in a way you can disable it on a per User or per Session basis see Stack Overflow: Disable Trigger per Session 您可以通过按每个用户或每个会话禁用触发器的方式对触发器进行编码,请参阅堆栈溢出:禁用每个会话的触发器

But the better solution for a variety of concurrency and data consistency problems would be to use a professional backup/mirroring solution. 但是,针对各种并发和数据一致性问题的更好解决方案是使用专业的备份/镜像解决方案。

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

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