--step1 connect repadmin/repadmin@orc1 --step2:Quiesce the master group that contains the table to which you --want to apply the conflict resolution method. BEGIN DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY ( gname => 'hr_test_repg'); END; / --step3:Add an additional column to the table to record the timestamp value --when a row is inserted or updated. BEGIN DBMS_REPCAT.ALTER_MASTER_REPOBJECT ( sname => 'hr', oname => 'test1', type => 'TABLE', ddl_text => 'ALTER TABLE hr.test1 ADD (z NUMBER(5))'); END; / --step3:Add an additional column to the table to record the timestamp value --when a row is inserted or updated. BEGIN DBMS_REPCAT.ALTER_MASTER_REPOBJECT ( sname => 'hr', oname => 'test1', type => 'TABLE', ddl_text => 'ALTER TABLE hr.test1 ADD (timestamp DATE)'); END; / BEGIN DBMS_REPCAT.ALTER_MASTER_REPOBJECT ( sname => 'hr', oname => 'test1', type => 'TABLE', ddl_text => 'ALTER TABLE hr.test1 ADD (m NUMBER(5),timestamp1 DATE)'); END; / --Step 4:Regenerate replication support for the altered table. BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'test1', type => 'TABLE', min_communication => TRUE); END; / --Step 5: Create a trigger that records the timestamp when a row is either inserted or updated. BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_test_repg', type => 'TRIGGER', oname => 'insert_time', sname => 'hr', ddl_text => 'CREATE TRIGGER hr.insert_time BEFORE INSERT OR UPDATE ON hr.test1 FOR EACH ROW BEGIN IF DBMS_REPUTIL.FROM_REMOTE = FALSE THEN :NEW.TIMESTAMP := SYSDATE; END IF; END;'); END; / --Step 6: Create a column group for your target table. BEGIN DBMS_REPCAT.MAKE_COLUMN_GROUP ( sname => 'hr', oname => 'test1', column_group => 'test1_timestamp_cg', list_of_column_names => 'z,timestamp'); END; / BEGIN DBMS_REPCAT.MAKE_COLUMN_GROUP ( sname => 'hr', oname => 'test1', column_group => 'test1_timestamp1_cg', list_of_column_names => 'm,timestamp1'); END; / --Step 7" Define the conflict resolution method for a specified table.(Latest timestamp) BEGIN DBMS_REPCAT.ADD_UPDATE_RESOLUTION ( sname => 'hr', oname => 'test1', column_group => 'test1_timestamp_cg', sequence_no => 1, method => 'LATEST TIMESTAMP', parameter_column_name => 'timestamp'); END; / BEGIN DBMS_REPCAT.ADD_UPDATE_RESOLUTION ( sname => 'hr', oname => 'test1', column_group => 'test1_timestamp1_cg', sequence_no => 1, method => 'LATEST TIMESTAMP', parameter_column_name => 'timestamp1'); END; / --Step 8: Regenerate replication support for the table that received the conflict resolution method. BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'test1', type => 'TABLE', min_communication => TRUE); END; / --Step 9:Resume replication activity BEGIN DBMS_REPCAT.RESUME_MASTER_ACTIVITY ( gname => 'hr_test_repg'); END; /