5.1.4. Setting the Replication Start Position

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. Setting a Specific Start Position

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.

  1. Determine the SCN from which you would like to begin replication.

  2. When installing the replicator do not include the --start-and-report option, or ensure it is set to false. tpm will install the replicator but will not start the service or bring it online.

  3. After installation completes successfully, start the replicator on the source Oracle instance and bring it online using the following commands:

    shell> replicator start offline
    shell> trepctl online -from-event #####
  4. Start the target replicator(s) normally using:

    shell> replicator start

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.

SQL> select current_scn from v$database;


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.


It is important to note that specifying an older SCN will require the source host to still have, on disk, all the Archive Logs up to and including that position. If you have RMAN or some other process periodically backing up and removing Archive Logs, you will need to restore them first. Resetting Existing Replication to a specific SCN

You can reset replicators to begin extracting from a specific SCN after replication has been installed using the following procedure:

  1. Reset target and source replicators using the reset command to clear all logs:

    shell> trepctl offline
    shell> trepctl -service servicename reset -all -y
  2. Bring the source replicator online starting at the desired SCN:

    shell> trepctl -service servicename online -from-event 14140241
  3. Bring the target replicator online normally:

    shell> trepctl -service servicename online Forcing replication to restart from a new SCN without resetting the THL

You can use the -from-event 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.

  1. Bring the source replicator offline and reset the redo component only.

    shell> trepctl -service servicename offline
    shell> trepctl -service servicename reset -redo -y
  2. Bring the source replicator online starting at the desired SCN.

    shell> trepctl -service servicename online -from-event 61754320

Target replicators will automatically reconnect to the source replicator.