Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

3. Synchronize data

Use the SCN SCNs from step 2 to load the historical data (Example use datapump with flashback_scn=xxx)

...

.
For 2-way replication you cannot simply move the historical data from the database A to B and vice versa, because Dbvisit Replicate would try to replicate this data back as soon as the apply processes are resumed. This would cause the data corruption and replication conflicts, as the data is already in both databases. 

To synchronize the data properly, use the named Oracle transaction. Dbvisit Replicate engine will recognize the name of the transaction and will not replicate any change done by such transaction.

Run the following command to obtain an Apply database name:

Panel
bgColorCCC
dbvrep> show apply_database
APPLY1.APPLY_DATABASE = UNITSRC
APPLY.APPLY_DATABASE = UNITTRG
APPLY1.APPLY_DATABASE_DBID = 433515465
*.APPLY_DATABASE =
APPLY.APPLY_DATABASE_DBID = 742136697
*.APPLY_DATABASE_DBID =

 

 

...

To move the data from the database UNITTRG to the database UNITSRC set the transaction name to DBREPL_DB_UNITSRC_XID_xxx, where "xxx" is APPLY1.APPLY_DATABASE value obtained earlier. 

Use the database link to select the data from the UNITTRG database using the SCN given by the PREPARE TABLE command. Notice the MINUS clause to omit a data common to both tables.

On UNITSRC database run:

Panel
bgColorCCC
SET TRANSACTION NAME 'DBREPL_DB_UNITSRC_XID_UNITSRC';
insert into SCHEMA_RECREATE.schema_recreate_tbl (id, member)
select id, member from SELECT id, member 
      FROM SCHEMA_RECREATE.schema_recreate_tbl@unittrg
as of scn 43298074;

 

...

      AS OF SCN 43298074
    MINUS SELECT id, member     
            FROM SCHEMA_RECREATE.schema_recreate_tbl;
COMMIT;

To move the data from UNITSRC to UNITTRG repeat the previous steps using the APPLY.APPLY_DATABASE value for the transaction name, the database link to UNITSRC and the SCN given by PREPARE TABLE.

On UNITTRG database run:

Panel
bgColorCCC
SET TRANSACTION NAME 'DBREPL_DB_UNITTRG_XID_UNITTRG';
insert into SCHEMA_RECREATE.schema_recreate_tbl (id, member)
select id, member from SELECT id, member 
      FROM SCHEMA_RECREATE.schema_recreate_tbl@unitsrc
as of scn 43348595 AS OF SCN 43348595
    MINUS SELECT id, member     
            FROM SCHEMA_RECREATE.schema_recreate_tbl;
COMMIT;

4. Resume the replication

 

 

Resume both the APPLY and APPLY1 processes:

Panel
bgColorCCC
dbvrep> choose replication MINE
Process type MINE set to: MINE.
Process type APPLY set to: APPLY.
dbvrep> resume apply
Apply requested to resume.
dbvrep> choose replication MINE1
Process type MINE set to: MINE1.
Process type APPLY set to: APPLY1.
dbvrep> resume apply1
Apply requested to resume.

...

Note that the table needs to exist on the target side before the apply process can be resumed. Using a datapump in step 3 is a good choice, since the import creates table automatically if it does not exist.

Adding new schemas

 

Removing tables & schemas

...