Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Quick question about triggers and replication
I have a trigger on a table that mimics the MS SQL Server autonumber
fields as follows:
CREATE OR REPLACE TRIGGER mySchema.myAutoNumber BEFORE
INSERT ON mySchema.myTable FOR EACH ROW WHEN (new.autoid is null)
begin
select mySeq.nextval into :new.autoid from dual;
end;
This table is being replicated to a remote database as an updatable materialized view (using primary key). This MV site is a passive standby site and is only used in the times of scheduled outages and not so scheduled outages!
The above trigger is on both the master and MV base table. The master site has all even autonumbers, the MV site has all odd autonumbers.
I have googled around and have read that triggers on MV base tables fire when they receive a record from the master site. Later I read on another site that not all triggers on base tables fire.
Also found that the way to stop a trigger firing is by including "DBMS_REPUTIL.FROM_REMOTE = FALSE" eg
CREATE OR REPLACE TRIGGER mySchema.myAutoNumber BEFORE INSERT ON mySchema.myTable FOR EACH ROW WHEN (new.autoid is null) begin
IF DBMS_REPUTIL.FROM_REMOTE = FALSE THEN
select mySeq.nextval into :new.autoid from dual;
END IF;
end;
My questions are:
Many thanks
Edwinah63 Received on Mon Mar 27 2006 - 22:30:31 CST