-
Oracle Replication
3 tables are replicated under 1 replication group
( Multimaster replication)
table 1
table 2
table 3
On the other hand, 2 triggers created on table1 in such a way
after insert into table1 --->do insert into table 2 and table 3
after delete into table1 --->do delete into table 2 and table 3
Will this affect the replication?
My confusion is that the replicated data to the other site might fire those two triggers again. and try to duplicate the transactions on both table 2 and table 3 which are already replicated.
I am not sure, can someone explain?
-
You are correct ... The triggers on other databases will fire ..
In order to keep this from happening you need to put a couple of
lines of code in EVERY trigger in the replicated environment ...
You need to tell the triggers that if this transaction is from
replication, the DON'T execute :
Ex 1: (Multi-Master)
CREATE OR REPLACE TRIGGER sysadm.tbi_bankdep_1
BEFORE insert
ON user.deposit
REFERENCING NEW AS NEWDATA OLD AS OLDDATA
FOR EACH ROW
BEGIN
if dbms_reputil.from_remote()
then
return;
end if;
.....
Ex 2: (Snapshot)
CREATE OR REPLACE TRIGGER sysadm.tbi_bankdep_1
BEFORE insert
ON user.deposit
REFERENCING NEW AS NEWDATA OLD AS OLDDATA
FOR EACH ROW
BEGIN
if dbms_reputil.from_remote() OR DBMS_SNAPSHOT.I_AM_A_REFRESH()
then
return;
end if;
.....
HTH
Gregg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|