Versions Compared

Key

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

All keywords are case-insensitive.

...

Align

Used for adding tables or schemas to the replication.

Prepares a schema/table for replication and declares that their content is in sync as of now. If a schema is prepared and DDL replication is enabled, new tables created in this schema in future will be also prepared and replicated. By default, this command connects to running APPLY and MINE and instructs them to replicate the schema/table. If OFFLINE is used, APPLY/MINE will pick the new tables on the next start. Use OFFLINE if the APPLY and MINE are not running, as some network configurations may cause long timeouts while PREPARE tries to connect to the APPLY/MINE.

By default, DDL replication is enabled. Use NODDL to disable it (mandatory for non-Oracle databases). 

RENAME clause makes the replication to APPLY the changes to the given schema/table at APPLY. Note that the RENAME TO clause requires the NODDL option.

PREPARE will lock the table to ensure no inflight transactions are missed.

During initial setup in the *.dbvrep script, the PREPARE command is often preceded with the ENGINE LOCK TABLES, or ENGINE LOCK SCHEMAS command (followed by the RELEASE LOCK).

Prepare recognizes that the ENGINE LOCK command has run and use the SCN from the lock. So when multiple tables are prepared, only a single SCN is used for all tables. When an ENGINE LOCK command has been issued in the same session, then the PREPARE command will no longer lock the tables. To clear the session, restart the console.

When using 'prepare as of SCN ' command to include tables in the on-going replication from pre-specified SCN, make sure that the current SCN of replication ( where MINE and APPLY is right now) is not greater than the SCN in "prepare as of SCN" command. 

Example:

No Format
bgColorCCC
dbvrep> PREPARE as of 79728416 TABLE scott.test1 noddl                                                                                                          
Prepare enabled supplemental logging, waiting for SCN advance enough to prevent ORA-01466 during consistent export....Waited 1 seconds until scn_to_timestamp changed.
Connecting to running apply [SCOTT.TEST1]: [Apply table removed (0 metadata record(s)). Apply table added (1 metadata record(s)).]
Connecting to running mine [SCOTT.TEST1]: [Table prepared (1 internal records).]
Table SCOTT.TEST1 instantiated at SCN 79728416
dbvrep>  

...

Image RemovedImage Removed

...


Note

Please read the following page before using AS OF <scn> clause: Adding new object from a given SCN

Anchor
PREPARE_AND_LOAD
PREPARE_AND_LOAD
PREPARE_AND_LOAD

Image AddedImage Added

Prepares the new table to be added into the replication stream.  Also LOADs the table at the same time.  With this one command the table is prepared for all future changes and then loads the target table with all of the historical rows in the source table.  The target table will have to be created before running this command.  The dbvrep user on the SOURCE database will need to have SELECT and FLASHBACK privileges on the table that is being prepared and loaded.

Note

Please read the following page before using AS OF <scn> clause: Adding new object from a given SCN

Example:

No Format
bgColorCCC
dbvrep> PREPARE_AND_LOAD TABLE SCOTT.REPTEST4  
Connecting to running apply [SCOTT.REPTEST4]: [Apply table removed (0 metadata record(s)). Apply table added (1 metadata record(s)).]
Connecting to running mine [SCOTT.REPTEST4]: [Table prepared (1 internal records).]
Table OLLIE.REPTEST4 instantiated at SCN 31096663
Table OLLIE.REPTEST4 will be loaded using SCN 31096663.
Connecting to running mine [SCOTT.REPTEST4]: [1 records processed.]
dbvrep>

...

Reprepare runs the UNPREPARE and PREPARE commands in a single step to save typing. It also understands that there is no need to drop supplemental logging in the unprepare phase as prepare would create it again.

Note

Please read the following page before using AS OF <scn> clause: Adding new object from a given SCN

Example:

No Format
bgColorCCC
dbvrep> REPREPARE TABLE SCOTT.DEPT3                                                                                                                             
Connecting to running mine [SCOTT.DEPT3]: [Table unprepared (1 internal records).]
Connecting to running apply:[Apply table removed (1 metadata record(s)). Apply table added (0 metadata record(s)).]
Table SCOTT.DEPT3 processed.
Connecting to running apply [SCOTT.DEPT3]: [Apply table removed (0 metadata record(s)). Apply table added (1 metadata record(s)).]
Connecting to running mine [SCOTT.DEPT3]: [Table prepared (1 internal records).]
Table SCOTT.DEPT3 instantiated at SCN 79653884
dbvrep>

dbvrep> REPREPARE AS OF 79653884 TABLE SCOTT.DEPT3                                                                                                              
Connecting to running mine [SCOTT.DEPT3]: [Table unprepared (1 internal records).]
Connecting to running apply:[Apply table removed (1 metadata record(s)). Apply table added (0 metadata record(s)).]
Table SCOTT.DEPT3 processed.
Connecting to running apply [SCOTT.DEPT3]: [Apply table removed (0 metadata record(s)). Apply table added (1 metadata record(s)).]
Connecting to running mine [SCOTT.DEPT3]: [Table prepared (1 internal records).]
Table SCOTT.DEPT3 instantiated at SCN 79653884
dbvrep>

...

The DEFAULT conflict handler will not be applied to existing prepared (replicated) tables. The DEFAULT conflict handler will only be applied to tables that are prepared after the DEFAULT conflict handler is set. To change the conflict handler for existing prepared tables, each table has to be individually set using FOR TABLE conflict handler.

Example:

 

No Format
bgColorCCC
dbvrep> SET_CONFLICT_HANDLERS FOR TABLE SCOTT.DEPT FOR UPDATE on NO_DATA TO OVERWRITE                                                                           
Connecting to running apply: [The table called SCOTT.DEPT on source is handled on apply (APPLY) as follows:
UPDATE (error): handler: RETRY logging: LOG
UPDATE (no_data): handler: OVERWRITE logging: LOG
UPDATE (too_many): handler: RETRY logging: LOG
DELETE (error): handler: RETRY logging: LOG
DELETE (no_data): handler: RETRY logging: LOG
DELETE (too_many): handler: RETRY logging: LOG
INSERT (error): handler: RETRY logging: LOG
TRANSACTION (error): handler: RETRY logging: LOG]
dbvrep>  

...