5.1.2. Oracle Replication on Oracle RAC

If you are planning on using the extractor against Oracle RAC, then you need to adopt the Offboard with Fetcher model.

This section outlines the steps required for an installation of the Oracle Extractor consisting of both the Tungsten Replicator and the Redo Reader MINE process configured on an Off-board host, and the FETCHER process configured with RAC.

First, ensure you have configured all the necessary Prerequisites, outlined in Section B.5, “Oracle Database Setup” paying particular attention to the Off-board and RAC specific prerequisites.

The diagram below represents a typical RAC Extractor Installation

Figure 5.2. Topologies: Extraction from Oracle RAC

Topologies: Extraction from Oracle RAC

There are two methods for installation, either via a Staging Install or via an ini install, along with two final steps to configure the FETCHER and setup RAC to manage the FETCHER process.

5.1.2.1. Configure RAC Application VIP

Before we begin to configure the replicator, we need to ensure we have an Application VIP configured and running within the RAC Cluster.

This VIP address will then be used in the configuration of the Replicator as demonstrated in the remaining sections of this chapter.

  1. Create the Application VIP (The example here assigns an IP address of 192.168.1.100 - replace this with an appropriate address for your environment)

    shell> appvipcfg create -network=1 -ip=192.168.1.100 -vipname=FetcherVIP -user=root [-failback=0 | 1]

    The default value of the -failback option is 0. If you set the option to 1, then the VIP (and therefore the Fetcher as well) fails back to the original node when it becomes available again.

  2. As root, allow the Oracle Grid infrastructure software owner (e.g. oracle) to run the script to start the VIP.

    shell> crsctl setperm resource FetcherVIP -u user:oracle:r-x
  3. To check the status of the VIP, run

    shell> crsctl status res FetcherVIP -p
  4. To start the VIP run

    shell> crsctl start resource FetcherVIP
  5. To relocate the VIP to another node, run

    shell> crsctl relocate resource FetcherVIP -n nodename -f
  6. Create an entry in the /etc/hosts on ALL RAC Nodes and the off-board host that resolve to this new VIP, e.g.

    shell> cat /etc/hosts
    
    192.168.1.100	racvip

5.1.2.2. Staging Install via SSH

This procedure will install Oracle extraction (including the Redo Reader) to the Offboard host via SSH from a single staging host.

At the end of this process, you will then need to follow the remaining manual steps outline in Section 5.2.4.3 "Complete FETCHER Installation" and 5.2.4.4 "Complete RAC Integration"

The tpm install command will:

  • Validate the Replicator and Oracle Redo Reader

  • Configure the Oracle Redo Reader

  • Configure the Replicator

For a RAC installation, you will create an Application VIP within Oracle Clusterware. During this process you will assign a VIP to the cluster that will only ever be active against one of the RAC Nodes. It is the Node that holds the VIP that will be the target host for the FETCHER process. If the VIP moves, the FETCHER process moves. For that reason, in the example configs below where you see "racvip" it is this VIP Address that you need to specify.

To install Tungsten Replication follow these steps:

  1. Install the Tungsten Replicator package (see Section 2.1.2, “Using the RPM and DEB package files”), or download the compressed tarball and unpack it:

    shell-staging> cd /opt/continuent/software
    shell-staging> tar zxf tungsten-replicator-oracle-source-6.0.1.tar.gz
  2. Change to the Tungsten Replicator staging directory:

    shell-staging> cd tungsten-replicator-oracle-source-6.0.1
  3. Configure the staging directory with the desired defaults:

    shell-staging> ./tools/tpm configure defaults --reset \
        --install-directory=/opt/continuent \
        --user=tungsten

    Click the icon to show a detailed description of each argument.

  4. Now configure the replicator specifics (In this example, the service name is alpha):

    shell-staging>./tools/tpm configure alpha \
    --master=offboardhost \
    --members=offboardhost \
    --replication-host=racvip \
    --replication-user=tungsten_alpha \
    --replication-password=secret \
    --datasource-type=oracle \
    --datasource-oracle-service=ORCL \
    --install-oracle-redo-reader=true \
    --oracle-redo-tablespace=TUNGSTEN_TS \
    --oracle-redo-replicate-tables=SCHEMA1,SCHEMA2,SCHEMA3, SCHEMA4.TABLE1 \
    --oracle-redo-fetcher-host=racvip \
    --oracle-sys-user-password=secret \
    --oracle-system-user-password=secret \
    --oracle-extractor-method=redo

    Click the icon to show a detailed description of each argument.

  5. Once the pre-requisites and configuring of the installation has been completed, the software can be installed:

    shell-staging> ./tools/tpm install

During the installation, tpm will notify you of any problems that need to be fixed before the service can be correctly installed. Correct any issues, and re-try the installation.

If the Oracle values are not correct, the tpm command may fail with an error like There was an error while processing the Oracle Redo Reader response file. Look at the /tmp/tungsten-configure.log file for more information about the root cause.

After installation, the Replicator will not be started, do NOT proceed beyond this point until you have completed all the steps in the following sections:

Once that is complete, you can then continue to start and check replication status on the off-board host as follows:

shell-offboardhost> . /opt/continuent/share/env.sh
shell-offboardhost> replicator start
shell-offboardhost> orarrd_alpha status
shell-offboardhost> trepctl status

A typical example of the output from the above commands is as follows:

shell-offboardhost> replicator start
Starting Tungsten Replicator Service...
Waiting for Tungsten Replicator Service......
running: PID:3771

Check that the orarrd process is running for the configured service:

shell-offboardhost> orarrd_alpha status
orarr is running:  PID: 3938

Check the replicator status using trepctl status:

shell-offboardhost> trepctl status
Processing status command...
NAME                     VALUE
----                     -----
appliedLastEventId     : 1271826#0004.019.000003ca#LAST#1270862#151
appliedLastSeqno       : 6
appliedLatency         : 6.312
autoRecoveryEnabled    : false
autoRecoveryTotal      : 0
channels               : 1
clusterName            : alpha
currentEventId         : 1338062
currentTimeMillis      : 1510766541032
dataServerHost         : racvip
extensions             :
host                   : offboardhost
latestEpochNumber      : 0
masterConnectUri       : thl://localhost:/
masterListenUri        : thl://offboardhost:2112/
maximumStoredSeqNo     : 6
minimumStoredSeqNo     : 0
offlineRequests        : NONE
pendingError           : NONE
pendingErrorCode       : NONE
pendingErrorEventId    : NONE
pendingErrorSeqno      : -1
pendingExceptionMessage: NONE
pipelineSource         : UNKNOWN
relativeLatency        : 24781.031
resourceJdbcDriver     : oracle.jdbc.driver.OracleDriver
resourceJdbcUrl        : jdbc:oracle:thin:@ORCL
resourcePrecedence     : 99
resourceVendor         : oracle
rmiPort                : 10000
role                   : master
seqnoType              : java.lang.Long
serviceName            : alpha
serviceType            : local
simpleServiceName      : alpha
siteName               : default
sourceId               : racvip
state                  : ONLINE
timeInStateSeconds     : 24881.235
timezone               : GMT
transitioningTo        :
uptimeSeconds          : 24883.168
useSSLConnection       : false
version                : Tungsten Replicator for Oracle (Source) 6.0.1
Finished status command...

5.1.2.3. ini Based Installation

This procedure will install Oracle extraction (including the Redo Reader) to the Offboard host using an ini file.

At the end of this process, you will then need to follow the remaining manual steps outline in Section 5.2.4.3 "Complete FETCHER Installation" and 5.2.4.4 "Complete RAC Integration"

The tpm install command will:

  • Validate the Replicator and Oracle Redo Reader

  • Configure the Oracle Redo Reader

  • Configure the Replicator

For a RAC installation, you will create an Application VIP within Oracle Clusterware. During this process you will assign a VIP to the cluster that will only ever be active against one of the RAC Nodes. It is the Node that holds the VIP that will be the target host for the FETCHER process. If the VIP moves, the FETCHER process moves. For that reason, in the example configs below where you see "racvip" it is this VIP Address that you need to specify.

To install Tungsten Replication follow these steps:

  1. Install the Tungsten Replicator Section 2.1.2, “Using the RPM and DEB package files” RPM or download the compressed tarball and unpack it:

    shell> cd /opt/continuent/software
    shell> tar zxf tungsten-replicator-oracle-source-6.0.1.tar.gz
  2. Change to the Tungsten Replicator staging directory:

    shell> cd tungsten-replicator-oracle-source-6.0.1
  3. Create /etc/tungsten/tungsten.ini, using the following as an example configuration:

    [defaults]
    install-directory=/opt/continuent
    user=tungsten
     
    [alpha]
    master=offboardhost
    members=offboardhost
    replication-host=racvip
    replication-user=tungsten_alpha
    replication-password=secret
    datasource-type=oracle
    datasource-oracle-service=ORCL
    install-oracle-redo-reader=true
    oracle-redo-tablespace=TUNGSTEN_TS
    oracle-redo-replicate-tables=SCHEMA1,SCHEMA2,SCHEMA3, SCHEMA4.TABLE1
    oracle-redo-fetcher-host=racvip
    oracle-sys-user-password=secret
    oracle-system-user-password=secret
    oracle-extractor-method=redo

    Click the icon to show a detailed description of each argument.

  4. Once the pre-requisites and configuring of the installation has been completed, the software can be installed:

    shell> ./tools/tpm install

During the installation, tpm will notify you of any problems that need to be fixed before the service can be correctly installed. Correct any issues, and re-try the installation.

If the Oracle values are not correct, the tpm command may fail with an error like "There was an error while processing the Oracle Redo Reader response file". Look at the /tmp/tungsten-configure.log file for more information about the root cause.

After installation, the Replicator will not be started, do NOT proceed beyond this point until you have completed all the steps in the following sections:

Once complete, you can then continue to start and check replication status on the off-board host as follows:

shell-offboardhost> . /opt/continuent/share/env.sh
shell-offboardhost> replicator start
shell-offboardhost> orarrd_alpha status
shell-offboardhost> trepctl status

A typical example of the output from the above commands is as follows:

shell-offboardhost> replicator start
Starting Tungsten Replicator Service...
Waiting for Tungsten Replicator Service......
running: PID:3771

Check that the orarrd process is running for the configured service:

shell-offboardhost> orarrd_alpha status
orarr is running:  PID: 3938

Check the replicator status using trepctl status:

shell-offboardhost> trepctl status
Processing status command...
NAME                     VALUE
----                     -----
appliedLastEventId     : 1271826#0004.019.000003ca#LAST#1270862#151
appliedLastSeqno       : 6
appliedLatency         : 6.312
autoRecoveryEnabled    : false
autoRecoveryTotal      : 0
channels               : 1
clusterName            : alpha
currentEventId         : 1338062
currentTimeMillis      : 1510766541032
dataServerHost         : racvip
extensions             :
host                   : offboardhost
latestEpochNumber      : 0
masterConnectUri       : thl://localhost:/
masterListenUri        : thl://offboardhost:2112/
maximumStoredSeqNo     : 6
minimumStoredSeqNo     : 0
offlineRequests        : NONE
pendingError           : NONE
pendingErrorCode       : NONE
pendingErrorEventId    : NONE
pendingErrorSeqno      : -1
pendingExceptionMessage: NONE
pipelineSource         : UNKNOWN
relativeLatency        : 24781.031
resourceJdbcDriver     : oracle.jdbc.driver.OracleDriver
resourceJdbcUrl        : jdbc:oracle:thin:@ORCL
resourcePrecedence     : 99
resourceVendor         : oracle
rmiPort                : 10000
role                   : master
seqnoType              : java.lang.Long
serviceName            : alpha
serviceType            : local
simpleServiceName      : alpha
siteName               : default
sourceId               : racvip
state                  : ONLINE
timeInStateSeconds     : 24881.235
timezone               : GMT
transitioningTo        :
uptimeSeconds          : 24883.168
useSSLConnection       : false
version                : Tungsten Replicator for Oracle (Source) 6.0.1
Finished status command...

5.1.2.4. Complete FETCHER Installation

Once you have completed the installation on the off-board host, you will then need to complete the installation on the Database Host.

Ensure the relevant Pre-Requisites are in place, in summary for the Database Host these are a much shorter list:

  • If you are not using the Oracle OS User for the FETCHER, ensure the user you do use is a privileged user and part of the same OS Group as the Oracle OS Owner account

  • Create a directory called /opt/continuent

  • Ensure you have a TNSNames entry for the local database

Now follow the following steps:

  1. Obtain the tarball distribution of the Tungsten Replicator package and place this in a temporary location, for example /tmp (Ensure this is the same version that you installed on the offboard host)

  2. If necessary, also obtain the Redo-Reader binaries appropriate to your target OS if it is not RHEL, CentOS or Oracle Linux

  3. Unpack them:

    shell> cd /tmp
    shell> tar zxf tungsten-replicator-oracle-source-6.0.1.tar.gz

    If required:

    shell> tar zxf orarr-2.9.06-xxx.tar.gz
  4. Locate the support packages

    shell> cd tungsten-replicator-oracle-source-6.0.1
    shell> cd tungsten-replicator/support/oracle-offboard-fetcher
  5. Execute the prepare-offboard-fetcher script

    shell> ./prepare-offboard-fetcher.pl <OPTIONS

    See ??? for full usage instructions

  6. DO NOT start any process yet, the final step is to configure RAC to manage this process using Oracle Clusterware. See Section 5.2.4.4 "Configure RAC Clusterware"

5.1.2.5. Complete RAC Integration

The final step in a RAC Configuration is to link the Application VIP we created as the first step with a Cluster Resource Group to manage the FETCHER process.

Although the FETCHER is installed on every node in a RAC cluster, it must only ever be running on one node. The use of Application VIP's and Cluster Resource Groups allows this process to be managed automatically in the case of a node failure.

In the examples below, we are using the VIP address 192.168.1.100 and our installation path was set to /opt/continuent. If you used a different name for the VIP, you will need to replace FetcherVIP in the examples below.

  1. Create the Resource Group

    shell> crsctl add resource TungstenFetcher -type cluster_resource \
       -attr "ACTION_SCRIPT=/opt/continuent/plog/alpha/action_script.scr, CHECK_INTERVAL=30,START_DEPENDENCIES='hard(FetcherVIP,ora.demodb.db,ora.asm) pullup(FetcherVIP)',STOP_DEPENDENCIES='hard(FetcherVIP)'"
  2. Start and stop the resource group

    shell> crsctl start resource TungstenFetcher
    shell> crsctl stop resource TungstenFetcher
  3. To relocate the resource to another RAC Node, simply use

    shell> crsctl relocate resource TungstenFetcher -n nodename -f

Warning

When the FETCHER is managed by clusterware, do not manually try to stop the process through the redo-reader console as clusterware will attempt to restart it

4. Providing there were no errors during startup, you should now see the FETCHER process running on whichever node currently holds the VIP, you can check this by running ps:

shell> ps -ef| grep orarr
shell> ps -ef| grep orarr
oracle      7316  5396  0 13:54 pts/2    00:00:00 grep --color=auto orarr
oracle      8175     1 11 09:39 ?        00:28:55 orarr FETCHER tungsten »
    --daemon --ddcfile /opt/continuent/plog/alpha/tungsten-FETCHER.ddc start FETCHER

5. At this point, you can now return the the Off-Board host and continue with the startup of the replicator process.