Quantcast
Channel: ATeam Chronicles
Viewing all articles
Browse latest Browse all 376

GoldenGate Cloud Service (GGCS): Replication from On-Premises to Oracle Public Cloud (OPC)

$
0
0

Introduction

This document will walk you through how to configure Oracle GoldenGate (OGG) replication between On-Premises Oracle Database to an Oracle Database Cloud Service (DBCS) on Oracle Public Cloud (OPC) via GoldenGate Cloud Service (GGCS).

Installation of Oracle GoldenGate for Oracle Database on the On-Premises and the provisioning of Oracle GGCS and DBCS are not discussed in this article, it is assumed that Oracle GoldenGate Software has been installed on the On-Premises server and instances for GGCS and DBCS already exist.

The scripts and information provided in this article are for educational purposes only. They are not supported by Oracle Development or Support, and come with no guarantee or warrant for functionality in any environment other than the test system used to prepare this article.

For details on OGG installation and provisioning of DBCS and GGCS, please check the following Oracle Documentation links:

GoldenGate Cloud Service (GGCS)

The GoldenGate Cloud Service (GGCS), is a cloud based real-time data integration and replication service, which provides seamless and easy data movement from various On-Premises relational databases to databases in the cloud with sub-second latency while maintaining data consistency and offering fault tolerance and resiliency.

Figure 1: GoldenGate Cloud Service (GGCS) Architecture Diagram

ggcs_architecture_01

OGG Replication between On-Premises and OPC via GGCS

The high level steps for OGG replication between On-Premises (source) database and DBaaS/DBCS (target) database in the Oracle Public Cloud (OPC) are as follows:

  • Configure and Start GGCS Oracle GoldenGate Manager on the OPC side
  • Configure and Start SSH proxy server process on the On-Premises
  • Configure and Start On-Premises OGG Extract process
  • Configure and Start On-Premises OGG Extract Data Pump process
  • Configure and Start GGCS Replicat process on the OPC side to deliver data into the target DBaaS/DBCS

GGCS Oracle GoldenGate Manager

To start configuring Oracle GoldenGate on the GGCS instance, the manager process must be running. Manager is the controller process that instantiates the other Oracle GoldenGate processes such as Extract, Extract Data Pump, Collector and Replicat processes.

Connect to GGCS Instance through ssh and start the Manager process via the GoldenGate Software Command Interface (GGSCI).

[oracle@ogg-wkshp db_1]$ ssh -i mp_opc_ssh_key opc@129.145.1.180

[opc@bics-gg-ggcs-1 ~]$ sudo su – oracle
[oracle@bics-gg-ggcs-1 ~]$ cd $GGHOME

Note: By default, “opc” user is the only one allowed to ssh to GGCS instance. We need to switch user to “oracle” via “su” command to manage the GoldenGate processes. The environment variable $GGHOME is  pre-defined in the GGCS instance and it’s the directory where GoldenGate was installled.

[oracle@bics-gg-ggcs-1 gghome]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.160517 OGGCORE_12.2.0.1.0OGGBP_PLATFORMS_160711.1401_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Jul 12 2016 02:21:38
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2016, Oracle and/or its affiliates. All rights reserved.

GGSCI (bics-gg-ggcs-1) 1> start mgr

Manager started.

GGSCI (bics-gg-ggcs-1) 2> info mgr

Manager is running (IP port bics-gg-ggcs-1.7777, Process ID 25272).

Note: By default, GoldenGate processes doesn’t accept any connection remotely. To enable connection from other hosts via the SSH proxy we need to add an ACCESS RULE to the Manager parameter File (MGR.prm) to allow connectivity through the public IP Address of the GGCS Instance.

Here’s the MGR.prm file used in this example:

–###############################################################
–## MGR.prm
–## Manager Parameter Template
— Manager port number
— PORT <port number>
PORT 7777
— For allocate dynamicportlist. Here the range is starting from
— port n1 through n2.
Dynamicportlist 7740-7760
— Enable secrule for collector
ACCESSRULE, PROG COLLECTOR, IPADDR 129.145.1.180, ALLOW
— Purge extract trail files
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPHOURS 24
— Start one or more Extract and Replicat processes automatically
— after they fail. –AUTORESTART provides fault tolerance when
— something temporary interferes with a process, such as
— intermittent network outages or programs that interrupt access
— to transaction logs.
— AUTORESTART ER *, RETRIES <x>, WAITMINUTES <y>, RESETMINUTES <z>
— This is to specify a lag threshold that is considered
— critical, and to force a warning message to the error log.
— Lagreport parameter specifies the interval at which manager
— checks for extract / replicat –lag.
–LAGREPORTMINUTES <x>
–LAGCRITICALMINUTES <y>
–Reports down processes
–DOWNREPORTMINUTES <n>
–DOWNCRITICAL

Start SSH Proxy Server on the On-Premises

By default, the only access allowed to GGCS instance is via ssh, so to allow communication of GoldenGate processes between On-Premises and GGCS instance we would need to run SSH proxy server on the on-premises side to communicate to GoldenGate processes on the GGCS instance.

Start the SSH proxy server process via the following ssh command (all in one line):

[oracle@ogg-wkshp db_1]$ ssh -i mp_opc_ssh_key -v -N -f -D 127.0.0.1:8888 opc@129.145.1.180 > ./dirrpt/socks.log 2>&1

Command Syntax: ssh –i {private_key_file} -v –N –f –D {istening_ip_address:listening_tcp_port_address} {user}@{GGCS_Instance_IP_address} > {output_file} 2>&1

SSH Command Options Explained:

  1. -i = Private Key file
  2. -v = Verbose Mode
  3. -N = Do no execute remote command; mainly used for port forwarding 
  4. -f = Run ssh process in the background
  5. -D Specifies to run as local dynamic application level forwarding; act as a SOCKS proxy server on a specified interface and port
  6. listening_ip_address = Host Name or Host IP Address where this SOCKS proxy will listen (127.0.0.1 is the loopback address)
  7. listening_tcp_port_address = TCP/IP Port Number to listen on
  8. 2>&1 = Redirect Stdout and Stderr to the output file
  9. Verify the SSH Socks Proxy server process has started successfully.

    1. Check the socks proxy output file via the “cat” utility and look for the messages “Local connections to forwarded…” and “Local forwarding listening on port ”.  Make sure it’s connected to GGCS instance and listening on the right IP and port address.

[oracle@ogg-wkshp db_1]$ cat ./dirrpt/socks.log

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 129.145.1.180 [129.145.1.180] port 22.
debug1: Connection established.
debug1: identity file keys/mp_opc_ssh_key type 1
debug1: loaded 1 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host ‘129.145.1.180’ is known and matches the RSA host key.

debug1: Authentication succeeded (publickey).
debug1: Local connections to 127.0.0.1:8888 forwarded to remote address socks:0
debug1: Local forwarding listening on 127.0.0.1 port 8888.
debug1: channel 0: new [port listener]
debug1: Entering interactive session.

Configure On-Premises Oracle GoldenGate

For our test, we shall use the following tables for source and target database:

CREATE TABLE ACCTN
(
ACCOUNT_NO NUMBER (10,0) NOT NULL
, BALANCE NUMBER (8,2) NULL
, PREVIOUS_BAL NUMBER (8,2) NULL
, LAST_CREDIT_AMT NUMBER (8,2) NULL
, LAST_DEBIT_AMT NUMBER (8,2) NULL
, LAST_CREDIT_TS TIMESTAMP NULL
, LAST_DEBIT_TS TIMESTAMP NULL
, ACCOUNT_BRANCH NUMBER (10,0) NULL
, CONSTRAINT PK_ACCTN
PRIMARY KEY
(
ACCOUNT_NO
)
USING INDEX
)
;
CREATE TABLE ACCTS
(
ACCOUNT_NO NUMBER (10,0) NOT NULL
, FIRST_NAME VARCHAR2 (25) NULL
, LAST_NAME VARCHAR2 (25) NULL
, ADDRESS_1 VARCHAR2 (25) NULL
, ADDRESS_2 VARCHAR2 (25) NULL
, CITY VARCHAR2 (20) NULL
, STATE VARCHAR2 (2) NULL
, ZIP_CODE NUMBER (10,0) NULL
, CUSTOMER_SINCE DATE NULL
, COMMENTS VARCHAR2 (30) NULL
, CONSTRAINT PK_ACCTS
PRIMARY KEY
(
ACCOUNT_NO
)
USING INDEX
)
;
CREATE TABLE BRANCH
(
BRANCH_NO NUMBER (10,0) NOT NULL
, OPENING_BALANCE NUMBER (8,2) NULL
, CURRENT_BALANCE NUMBER (8,2) NULL
, CREDITS NUMBER (8,2) NULL
, DEBITS NUMBER (8,2) NULL
, TOTAL_ACCTS NUMBER (10,0) NULL
, ADDRESS_1 VARCHAR2 (25) NULL
, ADDRESS_2 VARCHAR2 (25) NULL
, CITY VARCHAR2 (20) NULL
, STATE VARCHAR2 (2) NULL
, ZIP_CODE NUMBER (10,0) NULL
, CONSTRAINT PK_BRANCH
PRIMARY KEY
(
BRANCH_NO
)
USING INDEX
)
;
CREATE TABLE TELLER
(
TELLER_NO NUMBER (10,0) NOT NULL
, BRANCH_NO NUMBER (10,0) NOT NULL
, OPENING_BALANCE NUMBER (8,2) NULL
, CURRENT_BALANCE NUMBER (8,2) NULL
, CREDITS NUMBER (8,2) NULL
, DEBITS NUMBER (8,2) NULL
, CONSTRAINT PK_TELLER
PRIMARY KEY
(
TELLER_NO
)
USING INDEX
)
;

Start On-Premises Oracle GoldenGate Manager

[oracle@ogg-wkshp db_1]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.1.2.1.10 21604177 23004694_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Apr 29 2016 01:06:03
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

GGSCI (ogg-wkshp.us.oracle.com) 1> start mgr

Manager started.

GGSCI (ogg-wkshp.us.oracle.com) 2> info mgr

Manager is running (IP port ogg-wkshp.us.oracle.com.7809, Process ID 7526).

Configure and Start Oracle GoldenGate Extract Online Change Capture process 

Before we can configure the Oracle GoldenGate Extract Online Change process, we need to enable supplemental logging for the schema/tables we need to capture on the source database via the GGCSI utility.

Enable Table Supplemental Logging via GGCSI:

GGSCI (ogg-wkshp.us.oracle.com) 1> dblogin userid tpcadb password tpcadb

Successfully logged into database.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 2> add schematrandata tpcadb

2017-02-22 10:38:01 INFO OGG-01788 SCHEMATRANDATA has been added on schema tpcadb.
2017-02-22 10:38:01 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema tpcadb.

Note: The GGSCI “dblogin” command let’s the GGSCI session logged into the database. Your GGSCI session needs to be connected to the database before you can execute the “add schematrandata” command.

Create an Online Change Data Capture Extract Group via Integrated Extract process

For this test, we will name our Online Change Data Capture group process to ETPCADB.

-> Register the Extract group with the database via GGSCI:

GGSCI (ogg-wkshp.us.oracle.com) 1> dblogin userid tpcadb password tpcadb

Successfully logged into database.

Note: When creating/adding/managing an Extract group as an Integrated Extract process, your GGSCI session needs to be connected to the database via the “dblogin” command.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 2> register extract etpcadb database

Extract ETPCADB successfully registered with database at SCN 2373172.

-> Create/Add the Extract Group in GoldenGate via GGSCI:

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 3> add extract etpcadb, integrated, tranlog, begin now

EXTRACT added.

Note: To edit/create the Extract Configuration/Parameter file, you need to execute “edit param <group_name>” via the GGSCI utility.

GGSCI (ogg-wkshp.us.oracle.com) 1> edit param etpcadb

Here’s the Online Change Capture Parameter (etpcadb.prm) file used in this example:

EXTRACT ETPCADB
userid tpcadb, password tpcadb
EXTTRAIL ./dirdat/ea
discardfile ./dirrpt/etpcadb.dsc, append
TABLE TPCADB.ACCTN;
TABLE TPCADB.ACCTS;
TABLE TPCADB.BRANCH;
TABLE TPCADB.TELLER;

Add a local extract trail to the Online Change Data Capture  Extract Group via GGSCI

GGSCI (ogg-wkshp.us.oracle.com) 1> add exttrail ./dirdat/ea, extract etpcadb

EXTTRAIL added.

Start the Online Change Data Capture  Extract Group via GGSCI

GGSCI (ogg-wkshp.us.oracle.com) 2> start extract etpcadb

Sending START request to MANAGER …
EXTRACT ETPCADB starting

Check the Status of Online Change Data Capture  Extract Group via GGSCI

GGSCI (ogg-wkshp.us.oracle.com) 4> dblogin userid tpcadb password tpcadb

Successfully logged into database.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 5> info extract etpcadb detail

EXTRACT ETPCADB Last Started 2017-02-22 10:46 Status RUNNING
Checkpoint Lag 00:00:10 (updated 00:00:09 ago)
Process ID 10705
Log Read Checkpoint Oracle Integrated Redo Logs
2017-02-22 10:59:17
SCN 0.2394754 (2394754)
Target Extract Trails:
Trail Name Seqno RBA Max MB Trail Type
./dirdat/ea 0 1450 100 EXTTRAIL
Integrated Extract outbound server first scn: 0.2373172 (2373172)
Integrated Extract outbound server filtering start scn: 0.2373172 (2373172)
Extract Source Begin End
Not Available 2017-02-22 10:44 2017-02-22 10:59
Not Available * Initialized * 2017-02-22 10:44
Not Available * Initialized * 2017-02-22 10:44
Current directory /u01/app/oracle/product/12cOGG/db_1
Report file /u01/app/oracle/product/12cOGG/db_1/dirrpt/ETPCADB.rpt
Parameter file /u01/app/oracle/product/12cOGG/db_1/dirprm/etpcadb.prm
Checkpoint file /u01/app/oracle/product/12cOGG/db_1/dirchk/ETPCADB.cpe
Process file /u01/app/oracle/product/12cOGG/db_1/dirpcs/ETPCADB.pce
Error log /u01/app/oracle/product/12cOGG/db_1/ggserr.log

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 6> info all

Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING ETPCADB 00:00:09 00:00:08

Configure and Start Oracle GoldenGate Extract Data Pump process 

For this test, we will name our GoldenGate Extract Data Pump group process to PTPCADB.

Create the Extract Data Pump Group (Process) via GGSCI

The Extract Data Pump group process will read the trail created by the Online Change Data Capture Extract (ETPCADB) process and sends the data to the GoldenGate process running on the GGCS instance via the SSH Socks Proxy server.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 7> add extract ptpcadb, exttrailsource ./dirdat/ea

EXTRACT added.

Note: To edit/create the Extract Configuration/Parameter file, you need to execute “edit param <group_name>” via the GGSCI utility.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 8> edit param ptpcadb

Here’s the Extract Data Pump Parameter (ptpcadb.prm) file used in this example:

EXTRACT PTPCADB
RMTHOST 129.145.1.180, MGRPORT 7777, SOCKSPROXY 127.0.0.1:8888
discardfile ./dirrpt/ptpcadb.dsc, append
rmttrail ./dirdat/pa
passthru
table TPCADB.ACCTN;
table TPCADB.ACCTS;
table TPCADB.BRANCH;
table TPCADB.TELLER;

Add the remote trail to the Extract Data Pump Group via GGSCI

The remote trail is the location output file on the remote side (GGCS instance) used by the Extract Data Pump to write data to be read by the Replicat Delivery process and apply to the target database on the Oracle Database Cloud Service (DBCS) instance.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 9> add rmttrail ./dirdat/pa, extract ptpcadb

RMTTRAIL added.

Start the Extract Data Pump Group via GGSCI

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 10> start extract ptpcadb

Sending START request to MANAGER …
EXTRACT PTPCADB starting

Check the Status of Extract Data Pump Group via GGSCI 

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 11> info extract ptpcadb detail

EXTRACT PTPCADB Last Started 2017-02-22 11:12 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
Process ID 15281
Log Read Checkpoint File ./dirdat/ea000000
First Record RBA 0
Target Extract Trails:
Trail Name Seqno RBA Max MB Trail Type
./dirdat/pa 0 0 100 RMTTRAIL
Extract Source Begin End
./dirdat/ea000000 * Initialized * First Record
./dirdat/ea000000 * Initialized * First Record
Current directory /u01/app/oracle/product/12cOGG/db_1
Report file /u01/app/oracle/product/12cOGG/db_1/dirrpt/PTPCADB.rpt
Parameter file /u01/app/oracle/product/12cOGG/db_1/dirprm/ptpcadb.prm
Checkpoint file /u01/app/oracle/product/12cOGG/db_1/dirchk/PTPCADB.cpe
Process file /u01/app/oracle/product/12cOGG/db_1/dirpcs/PTPCADB.pce
Error log /u01/app/oracle/product/12cOGG/db_1/ggserr.log

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 13> info all

Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING ETPCADB 00:00:10 00:00:06
EXTRACT RUNNING PTPCADB 00:00:00 00:00:00

Configure and Start GGCS Oracle GoldenGate Delivery Process

Connect to GGCS Instance through ssh and go GoldenGate Software Command Interface (GGSCI) utility to configure GoldenGate Delivery process.

[oracle@ogg-wkshp db_1]$ ssh -i mp_opc_ssh_key opc@129.145.1.180

[opc@bics-gg-ggcs-1 ~]$ sudo su – oracle
[oracle@bics-gg-ggcs-1 ~]$ cd $GGHOME

Note: By default, “opc” user is the only one allowed to ssh to GGCS instance. We need to switch user to “oracle” via “su” command to manage the GoldenGate processes. The environment variable $GGHOME is  pre-defined in the GGCS instance and it’s the directory where GoldenGate was installled.

[oracle@bics-gg-ggcs-1 gghome]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.160517 OGGCORE_12.2.0.1.0OGGBP_PLATFORMS_160711.1401_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Jul 12 2016 02:21:38
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2016, Oracle and/or its affiliates. All rights reserved.

Configure GGCS Oracle GoldenGate Replicat Online Delivery group via Integrated process

Configure the Replicat Online Delivery group that reads the trail file that the Data Pump writes to and deliver the changes into the BICS DBCS.

Before configuring the delivery group as an Integrated delivery process, make sure that the GGSCI session is connected to the database via the GGSCI “dblogin” command.

GGSCI (bics-gg-ggcs-1) 1> dblogin useridalias ggcsuser_alias

Successfully logged into database BICSPDB1.

Create / Add the Replicat Delivery group as an Integrated process  and in this example we will name our Replicat Delivery group to RTPCADB.

GGSCI (bics-gg-ggcs-1 as c##ggadmin@BICS/BICSPDB1) 2> add replicat rtpcadb, integrated, exttrail ./dirdat/pa

REPLICAT (Integrated) added.

Note: To edit/create the Replicat Delivery Configuration/Parameter file, you need to execute “edit param <group_name>” via the GGSCI utility.

GGSCI (bics-gg-ggcs-1 as c##ggadmin@BICS/BICSPDB1) 3> edit param rtpcadb

Here’s the GGCS Replicat Online Delivery Parameter (rtpcadb.prm) file used in this example:

REPLICAT RTPCADB
useridalias ggcsuser_alias
–Integrated parameter
DBOPTIONS INTEGRATEDPARAMS (parallelism 2)
DISCARDFILE ./dirrpt/rtpcadb.dsc, APPEND Megabytes 25
ASSUMETARGETDEFS
MAP TPCADB.ACCTN, TARGET GGCSBICS.ACCTN;
MAP TPCADB.ACCTS, TARGET GGCSBICS.ACCTS;
MAP TPCADB.BRANCH, TARGET GGCSBICS.BRANCH;
MAP TPCADB.TELLER, TARGET GGCSBICS.TELLER;

Start the GGCS Replicat Online Delivery process via GGCSI 

GGSCI (bics-gg-ggcs-1 as c##ggadmin@BICS/BICSPDB1) 3> start replicat rtpcadb

Sending START request to MANAGER …
REPLICAT RTPCADB starting

Check the Status of GGCS Replicat Online Delivery process via GGSCI 

GGSCI (bics-gg-ggcs-1 as c##ggadmin@BICS/BICSPDB1) 4> info replicat rtpcadb detail

REPLICAT RTPCADB Last Started 2017-02-22 14:23 Status RUNNING
INTEGRATED
Checkpoint Lag 00:00:00 (updated 00:00:06 ago)
Process ID 25601
Log Read Checkpoint File ./dirdat/pa000000
2017-02-22 14:23:38.468569 RBA 0
INTEGRATED Replicat
DBLOGIN Provided, inbound server name is OGG$RTPCADB in ATTACHED state
Current Log BSN value: (no data)
Integrated Replicat low watermark: (no data)
(All source transactions prior to this scn have been applied)
Integrated Replicat high watermark: (no data)
(Some source transactions between this scn and the low watermark may have been applied)
Extract Source Begin End
./dirdat/pa000000 * Initialized * 2017-02-22 14:23
./dirdat/pa000000000 * Initialized * First Record
./dirdat/pa000000000 * Initialized * First Record
Current directory /u02/data/gghome
Report file /u02/data/gghome/dirrpt/RTPCADB.rpt
Parameter file /u02/data/gghome/dirprm/rtpcadb.prm
Checkpoint file /u02/data/gghome/dirchk/RTPCADB.cpr
Process file /u02/data/gghome/dirpcs/RTPCADB.pcr
Error log /u02/data/gghome/ggserr.log

At this point, we now have a complete OGG replication processes between the source Oracle database on the On-Premises to the target Oracle database on the OPC via GGCS.

Run Test Transactions

Now we are ready to run some transactions on the On-Premises source database and to be replicated by the GGCS onto the target database running on the DBCS instance on the OPC.

In this example, we start with empty tables on both source and target.

Check of Source Tables (On-Premises)

[oracle@ogg-wkshp db_1]$ sqlplus tpcadb/tpcadb <<EOF
select count(*) from ACCTN;
select count(*) from ACCTS;
select count(*) from BRANCH;
select count(*) from TELLER;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 12:56:14 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 12:49:42 -08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Check of Target Tables from GGCS Instance

[oracle@bics-gg-ggcs-1 ~]$ sqlplus ggcsbics@target/ggcsbics <<EOF
select count(*) from ACCTN;
select count(*) from ACCTS;
select count(*) from BRANCH;
select count(*) from TELLER;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 16:02:23 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 16:01:10 -05:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL>
COUNT(*)
———-
0
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

Note: When GGCS instance is provisioned, a default TNS net service name gets created in the tnsnames.ora of the GGCS instance and that is the “target” net service. This is the connection net service name that contains the connection information for the database that was associated to the GGCS instance when it was provisioned. The location of the tnsnames.ora can be found under the /u01/app/oracle/oci/network/admin directory.

Here’s a sample of the tnsnames.ora file that gets generated after the GGCS instance has been provisioned:

#GGCS generated file
target =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = BICS-DB)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = BICSPDB1.usoracle55293.oraclecloud.internal)
)
)

Run Test Transactions on the Source Tables (On-Premises) via SQLPLUS

Let’s start with insert transactions into the tables – inserting 2 records on each table a total of 8 operations since we have 4 tables.

[oracle@ogg-wkshp dirsql]$ sqlplus tpcadb/tpcadb <<EOF
INSERT INTO ACCTN (ACCOUNT_NO, BALANCE, PREVIOUS_BAL, LAST_CREDIT_AMT, LAST_CREDIT_TS, ACCOUNT_BRANCH) VALUES ( 83915, 1000, 0, 1000, TO_TIMESTAMP (‘2005-08-18:15:11:37.123456’, ‘YYYY-MM-DD:HH24:MI:SS.FF’), 82);
INSERT INTO ACCTN (ACCOUNT_NO, BALANCE, PREVIOUS_BAL, LAST_CREDIT_AMT, LAST_CREDIT_TS, ACCOUNT_BRANCH) VALUES ( 83916, 1000, 0, 1000, TO_TIMESTAMP (‘2005-08-18:15:11:37.123456’, ‘YYYY-MM-DD:HH24:MI:SS.FF’), 82);
COMMIT WORK;
INSERT INTO ACCTS (ACCOUNT_NO, FIRST_NAME, LAST_NAME, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP_CODE, CUSTOMER_SINCE) VALUES ( 83915, ‘Margarete’, ‘Smith’, ‘222 8th Ave’, ‘ ‘, ‘San Diego’, ‘CA’, 97827, to_date (‘1992-08-18’, ‘YYYY-MM-DD’));
INSERT INTO ACCTS (ACCOUNT_NO, FIRST_NAME, LAST_NAME, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP_CODE, CUSTOMER_SINCE) VALUES ( 83916, ‘Margarete’, ‘Howsler’, ‘1615 Ramona Ave’, ‘ ‘, ‘Fresno’, ‘CA’, 91111, to_date (‘1985-08-18’, ‘YYYY-MM-DD’));
COMMIT WORK;
INSERT INTO TELLER (TELLER_NO, BRANCH_NO, OPENING_BALANCE) VALUES ( 9815, 82, 10000 );
INSERT INTO TELLER (TELLER_NO, BRANCH_NO, OPENING_BALANCE) VALUES ( 9816, 83, 10000 );
COMMIT WORK;
INSERT INTO BRANCH (BRANCH_NO, OPENING_BALANCE, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP_CODE) VALUES ( 82, 100000, ‘7 Market St’, ‘ ‘, ‘Los Angeles’, ‘CA’, 90001);
INSERT INTO BRANCH (BRANCH_NO, OPENING_BALANCE, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP_CODE) VALUES ( 83, 100000, ‘222 8th Ave’, ‘ ‘, ‘Salinas’, ‘CA’, 95899);
COMMIT WORK;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 18:26:29 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 18:25:24 -08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
1 row created.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
1 row created.
SQL>
Commit complete.
SQL>
1 row created.
SQL>
1 row created.
SQL>
Commit complete.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Now, will do an update transactions into the tables – updating 2 records on each table a total of 8 update operations since we have 4 tables.

[oracle@ogg-wkshp dirsql]$ sqlplus tpcadb/tpcadb <<EOF
UPDATE ACCTN SET BALANCE=25000, PREVIOUS_BAL=1000 WHERE ACCOUNT_NO=83915;
UPDATE ACCTN SET BALANCE=55789, PREVIOUS_BAL=1000 WHERE ACCOUNT_NO=83916;
COMMIT WORK;
UPDATE ACCTS SET FIRST_NAME = ‘Margie’ WHERE ACCOUNT_NO=83915;
UPDATE ACCTS SET FIRST_NAME = ‘Mandela’ WHERE ACCOUNT_NO=83916;
COMMIT WORK;
UPDATE TELLER SET OPENING_BALANCE=99900 WHERE TELLER_NO=9815;
UPDATE TELLER SET OPENING_BALANCE=77777 WHERE TELLER_NO=9816;
COMMIT WORK;
UPDATE BRANCH SET TOTAL_ACCTS = 25000 WHERE BRANCH_NO = 82;
UPDATE BRANCH SET TOTAL_ACCTS = 55789 WHERE BRANCH_NO = 83;
COMMIT WORK;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 18:37:13 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 18:26:29 -08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
1 row updated.
SQL>
1 row updated.
SQL>
Commit complete.
SQL>
1 row updated.
SQL>
1 row updated.
SQL>
Commit complete.
SQL>
1 row updated.
SQL>
1 row updated.
SQL>
Commit complete.
SQL>
1 row updated.
SQL>
1 row updated.
SQL>
Commit complete.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Now, will do a delete transactions into the tables – deleting 1 record on each table a total of 4 delete operations since we have 4 tables.

[oracle@ogg-wkshp dirsql]$ sqlplus tpcadb/tpcadb <<EOF
DELETE FROM ACCTN WHERE ACCOUNT_NO = 83916;
DELETE FROM ACCTS WHERE ACCOUNT_NO = 83916;
DELETE FROM TELLER WHERE TELLER_NO = 9816;
DELETE FROM BRANCH where BRANCH_NO = 83;
COMMIT WORK;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 18:43:34 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 18:37:13 -08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
1 row deleted.
SQL>
1 row deleted.
SQL>
1 row deleted.
SQL>
1 row deleted.
SQL>
Commit complete.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Now, let’s just do a simple count via sqlplus of the final total number of records in our source database.

[oracle@ogg-wkshp db_1]$ sqlplus tpcadb/tpcadb <<EOF
select count(*) from ACCTN;
select count(*) from ACCTS;
select count(*) from BRANCH;
select count(*) from TELLER;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 21:40:28 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 21:18:00 -08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

At this point, we have executed the following operations:

Table Name Insert Update Delete Total Operations Final # of Rows/Records
TPCADB.ACCTN 2 2 1 5 1
TPCADB.ACCTS 2 2 1 5 1
TPCADB.TELLER 2 2 1 5 1
TPCADB.BRANCH 2 2 1 5 1

A total of 8 inserts, 8 updates, and 4 deletes.

Check Online Change Data Capture Extract process ETPCADB Statistics (On-Premises)

Now, let’s check the statistics for our Extract process ETPCADB via GGCSI “STATS” command, this should capture and reflect the operations we have just executed on the source tables.

GGSCI (ogg-wkshp.us.oracle.com) 1> dblogin userid tpcadb password tpcadb

Successfully logged into database.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 2> stats extract etpcadb, total, table *.*

Sending STATS request to EXTRACT ETPCADB …
Start of Statistics at 2017-02-22 21:26:13.
DDL replication statistics (for all trails):
*** Total statistics since extract started ***
Operations 21.00
Output to ./dirdat/ea:

Extracting from TPCADB.ACCTN to TPCADB.ACCTN:
*** Total statistics since 2017-02-22 18:49:44 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.ACCTS to TPCADB.ACCTS:
*** Total statistics since 2017-02-22 18:49:44 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.TELLER to TPCADB.TELLER:
*** Total statistics since 2017-02-22 18:49:44 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.BRANCH to TPCADB.BRANCH:
*** Total statistics since 2017-02-22 18:49:44 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00
End of Statistics.

Check Extract Datapump process PTPCADB Statistics (On-Premises)

Now, let’s check the statistics for our Extract Datapump process PTPCADB via the same GGCSI “STATS” command, this should also reflect the same number of operations we have just executed on the source tables.

GGSCI (ogg-wkshp.us.oracle.com as tpcadb@oracle) 3> stats extract ptpcadb, total, table *.*

Sending STATS request to EXTRACT PTPCADB …
Start of Statistics at 2017-02-22 21:48:44.
Output to ./dirdat/pa:

Extracting from TPCADB.ACCTN to TPCADB.ACCTN:
*** Total statistics since 2017-02-22 18:49:45 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.ACCTS to TPCADB.ACCTS:
*** Total statistics since 2017-02-22 18:49:45 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.TELLER to TPCADB.TELLER:
*** Total statistics since 2017-02-22 18:49:45 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00

Extracting from TPCADB.BRANCH to TPCADB.BRANCH:
*** Total statistics since 2017-02-22 18:49:45 ***
Total inserts                                 2.00
Total updates                                 2.00
Total deletes                                 1.00
Total discards                                0.00
Total operations                              5.00
End of Statistics.

Check Online Change Delivery Replicat process RTPCADB Statistics (GGCS Instance on the OPC)

Now, let’s check the statistics for our Online Delivery Replicat process RTPCADB via the same GGCSI “STATS” command we did for our Extract processes. This should also reflect the same number of operations we have just executed on the source tables and captured by the Extract (ETPCADB) process and was sent by Extract Datapump (PTPCADB) process.

GGSCI (bics-gg-ggcs-1) 1> dblogin useridalias ggcsuser_alias

Successfully logged into database BICSPDB1.

GGSCI (bics-gg-ggcs-1 as c##ggadmin@BICS/BICSPDB1) 2> stats replicat rtpcadb, total, table *.*

Sending STATS request to REPLICAT RTPCADB …
Start of Statistics at 2017-02-23 01:03:12.
Integrated Replicat Statistics:
Total transactions                             9.00
Redirected                                     0.00
DDL operations                                 0.00
Stored procedures                              0.00
Datatype functionality                         0.00
Event actions                                  0.00
Direct transactions ratio                      0.00%

Replicating from TPCADB.ACCTN to BICSPDB1.GGCSBICS.ACCTN:
*** Total statistics since 2017-02-23 00:59:41 ***
Total inserts                                  2.00
Total updates                                  2.00
Total deletes                                  1.00
Total discards                                 0.00
Total operations                               5.00

Replicating from TPCADB.ACCTS to BICSPDB1.GGCSBICS.ACCTS:
*** Total statistics since 2017-02-23 00:59:41 ***
Total inserts                                  2.00
Total updates                                  2.00
Total deletes                                  1.00
Total discards                                 0.00
Total operations                               5.00

Replicating from TPCADB.TELLER to BICSPDB1.GGCSBICS.TELLER:
*** Total statistics since 2017-02-23 00:59:41 ***
Total inserts                                  2.00
Total updates                                  2.00
Total deletes                                  1.00
Total discards                                 0.00
Total operations                               5.00

Replicating from TPCADB.BRANCH to BICSPDB1.GGCSBICS.BRANCH:
*** Total statistics since 2017-02-23 00:59:41 ***
Total inserts                                  2.00
Total updates                                  2.00
Total deletes                                  1.00
Total discards                                 0.00
Total operations                               5.00
End of Statistics.

Now, for the final step, let’s just do a simple count via sqlplus of the final total number of records in our target database and make sure that the result matches the total number of final records in our source database.

[oracle@bics-gg-ggcs-1 ~]$ sqlplus ggcsbics@target/ggcsbics <<EOF
select count(*) from ACCTN;
select count(*) from ACCTS;
select count(*) from BRANCH;
select count(*) from TELLER;
EOF

SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 23 01:12:24 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Wed Feb 22 2017 16:02:34 -05:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL>
COUNT(*)
———-
1
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

Summary

This article walked through the steps to on how to configure Oracle GoldenGate (OGG) replication between a source Oracle database on the On-Premises to a target Oracle Database running on the Database Cloud Service (DBCS) on the Oracle Public Cloud (OPC) using GoldenGate Cloud Service (GGCS).

Additional Resources:

Oracle Database Cloud Service (DBCS) 

Oracle GoldenGate Cloud Service (GGCS)

GGCS User Guide Documentation

GGCS Tutorial Section


Viewing all articles
Browse latest Browse all 376

Trending Articles