Positions within the Oracle replication processe can be identified and/or set using the Oracle System Change Number (SCN) reference. By setting the replication to start at a specific SCN you can take advantage of provisioning, or starting replication on specific known boundaries, for example, after a specific backup operation, or snapshot, has taken place.
By default tpm sets up Oracle replication to start at
the current position of the Oracle DBMS, which is denoted by the current
SCN. The replicator represents this value using the word
NOW. To enable default behavior
simply install normally and include the tpm --start-and-report option in
the installation. The replicator will extract the first transaction
committed after the time when the replicator was installed.
To start replication at a specific SCN in the past, you must bring the replicator online explicitly with an option that specifies the exact SCN where replication should start. Here are the exact steps.
Determine the SCN from which you would like to begin replication.
When installing the replicator do not include the --start-and-report option. tpm will install the replicator but will not start the service or bring it online.
After installation completes successfully, start the replicator on the source Oracle instance and bring it online using the following commands:
replicator start offlineshell>
trepctl online -from-event
Start the target replicator(s) normally using:
Replication will now start at the target SCN value. Here is a short example of how to select the target SCN and then bring the replicator online to pick up older changes.
select current_scn from v$database;CURRENT_SCN ----------- 14140241
Depending on how old the SCN is the replicator may take a while to extract up to the current position of the Oracle instance. You can confirm that older data were extracted by looking in the log using the thl utility.
You can reset replicators to begin extracting from a specific SCN after replication has been installed using the following procedure:
Reset target and source replicators using the reset command to clear all logs:
multi_trepctl -service servicename reset -y
Bring the source replicator online starting at the desired SCN:
trepctl -host sourcehost online -from-event 14140241
Bring the target replicator online normally:
trepctl -host targethost online
You can use the
command to change the position of replication in the source Oracle
instance. This allows you to skip over parts of the log or reposition
replication without disturbing target replicators.
Bring the source replicator offline and reset the redo component only.
trepctl -host sourcehost offlineshell>
trepctl -host sourcehost -service servicename reset -redo -y
Bring the source replicator online starting at the desired SCN.
trepctl -host sourcehost online -from-event 61754320
Target replicators will automatically reconnect to the source replicator.