5.1.5. Provisioning an Oracle Replication Solution

Note

The method explained here is only applicable for provisioning an Oracle target from an Oracle source. If you wish to provision data to a heterogenous target, see "Provisioning a Heterogenous Target"

You can provision an empty target Oracle schema from an existing one and start Tungsten Replicator while positioning redo log extraction correctly.

The instructions below assume the following:

  • Tungsten Replicator has not been installed on each of the source and target servers.

  • An active source Oracle installation with tables and data.

  • An active target Oracle installation, without the intended replication schema.

  • A full understanding of the variety of options available using Oracle Data Pump.

5.1.5.1. Provisioning with Oracle Data Pump

Important

When using this method, no open transactions must be running. Active transactions are not extracted and may result in inconsistencies

  1. Login to Oracle as sysdba and get current SCN position:

    shell> sqlplus / as sysdba
    
    SQL> SELECT CURRENT_SCN FROM v$database;
    
    CURRENT_SCN
    -----------
    6449931
  2. On the source server export the full schema at this specific SCN position to generate a consistent dump across all tables (note the parameter flashback_scn).

    shell> expdp system/Password11 directory=DATA_PUMP_DIR schemas=<SchemasToExport> \
        dumpfile=tungsten.dmp logfile=tungsten.log flashback_scn=6449931
  3. Copy the generated files to the target server.

    shell> scp /app/oracle/local/admin/ORCL/dpdump/tungsten.* \
        oracleslave.example.com:/app/oracle/local/admin/ORCL/dpdump/
  4. On the target server import the files.

    shell> impdp tungsten/secret DIRECTORY=DATA_PUMP_DIR \
        DUMPFILE=tungsten.dmp LOGFILE=tungsten.log

    Note

    If you get the following error messages when you try to import the data:

    ORA-39002: invalid operation
    ORA-39070: Unable to open the log file.
    ORA-39087: directory name DATA_PUMP_DIR is invalid

    Check the value of DATA_PUMP_DIR using:

    SQL> select * from all_directories where directory_name = 'DATA_PUMP_DIR';

    If you do not get a result, create the required directory:

    SQL> CREATE DIRECTORY DATA_PUMP_DIR AS ‘/path‘;

    If the directory already exists, then ensure the permissions for the user you are using to import the data:

    SQL> GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO tungsten;
  5. Install replication on the master server, for example using the instructions in Section 5.2, “Deploying the Oracle Redo Reader Extractor”.

    However, when starting replication, ensure that you use the instructions for setting an explicit SCN number when the replication starts. See Section 5.1.4.1, “Setting a Specific Start Position” for more information on setting this parameter during replication startup.

    shell> trepctl online -from-event 6449931