gavinsoorma.com.au · Web viewWe will create an Oracle 12c Release 2 database OGGDB which will host...

75
1 Oracle GoldenGate 18c and Oracle GoldenGate Cloud Services Workshop Lab Exercise 17 Oracle GoldenGate 18c and GoldenGate Cloud Services Workshop Hands-on Lab Exercise 17 Install and Configure Oracle GoldenGate Cloud Service Configure replication between On-premise and Oracle Cloud

Transcript of gavinsoorma.com.au · Web viewWe will create an Oracle 12c Release 2 database OGGDB which will host...

Oracle GoldenGate 18c and GoldenGate Cloud Services Workshop

Hands-on Lab Exercise 17

Install and Configure Oracle GoldenGate Cloud Service

Configure replication between On-premise and Oracle Cloud

Oracle GoldenGate Cloud Service Hands-On Lab Exercise

This note describes the steps used to configure Oracle GoldenGate replication between on-premise and the Oracle Cloud.

The on-premise database is Oracle 12c Release 2 (CDB1/PDB1) and the Oracle Database Classic Cloud Service instance is also Oracle 12c Release 2 (OGGDB). The GoldenGate version is 18.1 on the on-premise Oracle GoldenGate environment and the Oracle GoldenGate Cloud Service is also 18.1 (Classic).

The main steps involved are:

· Create the Oracle Database Service Instance

· Create the Oracle GoldenGate Cloud Service Instance

· Create the PuTTY private keys and configure PuTTY connections to the Cloud Database instance and GoldenGate Cloud Service instance

· Create the DEMO schema and MYOBJECTS table in the Oracle Database Service Cloud instance

· Configure SSH SOCKS Proxy Server for communication between on-premise server and Oracle Cloud

· Create the Credential Store in the Oracle GoldenGate Cloud Service environment

· Create the Replicat process Store in the Oracle GoldenGate Cloud Service environment

· Create the Extract and Pump processes in the on-premise Oracle GoldenGate environment

· Start the on-premise and GoldenGate Cloud Service GoldenGate Extract and Replicat processes

· Perform DML on the on-premise MYOBJECTS table and verify data being replicated to the Cloud database

Create the Oracle Cloud Database Service Instance

We need to create an Oracle Database Cloud Classic instance if we want to install Oracle GoldenGate Cloud Control as part of the Oracle GoldenGate Cloud instance.

We will create an Oracle 12c Release 2 database OGGDB which will host the Fusion Middleware type repository schemas for the GoldenGate Cloud Control application.

The OGGDB database will also serve as the Cloud target database instance for Oracle GoldenGate replication between On-Premise and Oracle Cloud.

Hence ensure that Enable Oracle GoldenGate option is checked.

Make a note of the Administration Password entered. This password is the common password for users like SYS,SYSTEM and the GoldenGate administrator common user C##GGADMIN which will also be created in the database.

Click on Download and then Done

This will download a zipped file called sshbundle.zip on your local machine. Rename this file to sshbundle_oggdb.zip and unzip the file.

Create the GoldenGate Cloud Service (GGCS) Instance

We will create a GGCS instance named GGCSINST which will also have the GoldenGate Cloud Control component in addition to the standard Replication component.

The GoldenGate version is 18.1 Classic.

Expand the Oracle Cloud My Services menu item on the top left and select GoldenGate.

Identify the Cloud Storage Container by opening the Storage Classic service page. Click on the Account tab and obtain the details from the Rest Endpoint item in the Account Information section.

In this case the URL is:

https://uscom-central-1b.storage.oraclecloud.com/v1/Storage-gsoorma

Select the database which we created earlier in the exercise (OGGDB) as this will serve as the repository for the GoldenGate Cloud Control schemas.

Note – the SYS password will be the Administration Password which we entered while creating the database.

Also make a note of the WebLogic Server administration password.

Click on SSH Public Key Edit button

Click on Download and Done

Rename the downloaded zip file to sshbundle_gginst.zip on your local machine.

Create the PuTTY Private Key (ppk)

Launch puttygen tool

Click on Load

Unzip the downloaded SSH Public Key file – we had saved the file as sshbundle_gginst.zip.

Open the folder containing the Private key/Public key pair of files (downloaded while creating the database or GGSC instance). Select the privateKey file and click Open.

Click on Save private key

Click on Yes

Enter the File name gginst and ensure Save as type is PuTTY Private Key Files

Note: Follow the same process for the SSH Public Key file we have downloaded while creating the Cloud Database instance

Connect to the Cloud Database instance (OGGDB)

Click on Dashboard

Make a note of the Public IP address – in this case it 129.150.86.72

Launch PuTTY

Enter the Public IP address and oggdb for Saved Sessions

Select Connection >> Data menu

Enter ‘oracle’ for the Auto-login username

Select Connection >> SSH>>Auth menu

Open the folder containing the Private key file (oggdb.ppk) which we would have created earlier using puttygen utility.

Click on Save and then Open

Click on Yes

Use the dbaascli tool to verify if the database has been enabled for GoldenGate

[oracle@OGGDB ~]$ dbaascli

DBAAS CLI version 18.4.3.1.0

DBAAS>gg status

Executing command gg status

Golden Gate status: enabled.

Note the GoldenGate admin user C##GGADMIN has been created in the database and also note the values for the database parameters STREAMS_POOL_SIZE and ENABLE_GOLDENGATE_REPLICATION.

[oracle@OGGDB ~]$ sqlplus sys as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 7 00:41:38 2019

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Enter password:

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select username from cdb_users where username like '%GGADMIN%';

USERNAME

--------------------------------------------------------------------------------

C##GGADMIN

SQL> show parameter streams

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

streams_pool_size big integer 272M

SQL> show parameter enable_goldengate

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

enable_goldengate_replication boolean TRUE

Create the DEMO schema and the MYOBJECTS table

SQL> grant dba to c##ggadmin container=all;

Grant succeeded.

SQL> alter session set container=pdb1;

Session altered.

SQL> create user demo identified by oracle

default tablespace users

temporary tablespace temp;

User created.

SQL> grant dba to demo;

Grant succeeded.

SQL> create table demo.myobjects as select * from all_objects

where 1=2;

Table created.

SQL> alter table demo.myobjects add constraint pk_myobjects

primary key (object_id);

Table altered.

Connect to the GoldenGate Cloud Service instance (OGGDB)

Click on Dashboard

Connect to the GGSC host via PuTTY

Note: we will connect as the ‘opc’ user

Click on Save and then Open.

Connect as the oracle user

[opc@ggcsinst-ggcs-1 ~]$ sudo su - oracle

Note the environment variables which have been automatically configured as well as the various symbolic links

[oracle@ggcsinst-ggcs-1 ~]$ env |grep AGENT

AGENT_INSTANCE_HOME=/u02/data/ggcc/agent

AGENT_HOME=/u01/app/oracle/middleware/ggccagent

[oracle@ggcsinst-ggcs-1 ~]$ env |grep GGHOME

GGHOME=/u01/app/oracle/gghome

[oracle@ggcsinst-ggcs-1 ~]$ cd /u01/app/oracle

[oracle@ggcsinst-ggcs-1 oracle]$ ls -l

total 12

lrwxrwxrwx. 1 root root 20 Feb 9 03:48 gghome -> /u02/data/gg123ora12

lrwxrwxrwx. 1 root root 21 Feb 9 03:48 gghome11g -> /u02/data/gg123ora11g

drwxr-x---. 2 oracle oracle 4096 Feb 9 03:48 gghome18c

drwxr-xr-x. 14 oracle oracle 4096 Feb 9 03:53 middleware

lrwxrwxrwx. 1 root root 13 Feb 9 03:48 oci -> /u02/data/oci

lrwxrwxrwx. 1 root root 22 Feb 9 03:48 oraInventory -> /u02/data/oraInventory

lrwxrwxrwx. 1 root root 13 Feb 9 03:48 rda -> /u02/data/rda

drwxr-xr-x. 6 root root 4096 Feb 9 03:43 tools

Note the location of the variables LD_LIBRARY_PATH and TNS_ADMIN which are defined via the .bashrc file

[oracle@ggcsinst-ggcs-1 ~]$ vi .bashrc

[oracle@ggcsinst-ggcs-1 ~]$ echo $LD_LIBRARY_PATH

/u01/app/oracle/oci:/u01/app/oracle/oci:

[oracle@ggcsinst-ggcs-1 ~]$ echo $TNS_ADMIN

/u01/app/oracle/oci/network/admin

Launch GGSCI

[oracle@ggcsinst-ggcs-1 ~]$ cd $GGHOME

[oracle@ggcsinst-ggcs-1 oracle]$ ls -l oci

lrwxrwxrwx. 1 root root 13 Feb 9 03:48 oci -> /u02/data/oci

[oracle@ggcsinst-ggcs-1 gghome]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 12.2.0.2.2 27274916_FBO

Linux, x64, 64bit (optimized), Oracle 12c on Dec 16 2017 03:36:13

Operating system character set identified as UTF-8.

Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved.

GGSCI (ggcsinst-ggcs-1) 1> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

JAGENT STOPPED

Create the GoldenGate Credential Store and add entries to the Credential Store

Copy the tnsnames.ora entries for OGGDB and PDB1 from Database Cloud machine to GGCS machine.

[oracle@OGGDB ~]$ cd $ORACLE_HOME

[oracle@OGGDB dbhome_1]$ cd network/admin

[oracle@OGGDB admin]$ vi tnsnames.ora

OGGDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = OGGDB.compute-612164189.oraclecloud.internal)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = OGGDB.612164189.oraclecloud.internal)

)

)

PDB1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = OGGDB.compute-612164189.oraclecloud.internal)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = pdb1.612164189.oraclecloud.internal)

)

)

[oracle@ggcsinst-ggcs-1 admin]$ pwd

/u01/app/oracle/oci/network/admin

[oracle@ggcsinst-ggcs-1 admin]$ vi tnsnames.ora

[oracle@ggcsinst-ggcs-1 admin]$ cd $GGHOME

[oracle@ggcsinst-ggcs-1 gghome]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 18.1.0.0.0 OGGCORE_18.1.0.0.0_PLATFORMS_180928.0432_FBO

Linux, x64, 64bit (optimized), Oracle 12c on Sep 29 2018 04:22:21

Operating system character set identified as UTF-8.

Copyright (C) 1995, 2018, Oracle and/or its affiliates. All rights reserved.

GGSCI (ggcsinst-ggcs-1) 1> add credentialstore

Credential store created.

GGSCI (ggcsinst-ggcs-1) 2> alter credentialstore add user c##ggadmin@pdb1 alias ggadmin

Password:

Credential store altered.

GGSCI (ggcsinst-ggcs-1) 3> dblogin useridalias ggadmin

Successfully logged into database PDB1.

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 4> exit

[oracle@ggcsinst-ggcs-1 gghome]$

Configure SSH Socks Proxy Server

Copy the SSH Private key file belonging to the GGCS machine to the on-premise VM rac01

Copy private key to shared folder and from the shared folder to the $HOME/.ssh directory

[oracle@rac01 .ssh]$ cp /media/sf_software/privateKey .

[oracle@rac01 .ssh]$ chmod 600 privateKey

[oracle@rac01 .ssh]$ ls -lrt

total 24

-rw-r--r-- 1 oracle oinstall 406 Jan 4 10:47 id_rsa.pub

-rw------- 1 oracle oinstall 1679 Jan 4 10:47 id_rsa

-rw-r--r-- 1 oracle oinstall 812 Jan 4 10:47 authorized_keys

-rw-r--r-- 1 oracle oinstall 2385 Feb 6 23:29 known_hosts

-rw------- 1 oracle oinstall 1675 Feb 7 18:07 privateKey

-v=Verbose Mode

-N=do not execute remote command, mainly used for port forwarding

-f=run ssh process in background

-D=act as a SOCKS proxy server

127.0.0.1=Host IP Address where SOCKS proxy will listen

8088=TCP/IP port number to listen on

opc=GGSC Cloud Instance server user

129.150.93.188=GGCS Cloud Instance server Public IP

[oracle@rac01 .ssh]$ ssh -i /home/oracle/.ssh/privateKey -v -N -f -D 127.0.0.1:8088 [email protected] > /tmp/socksproxy.log 2>&1

You have new mail in /var/spool/mail/oracle

Configure on-premise GoldenGate Extract and Pump

GGSCI (rac01.localdomain) 10> add extract ext3 integrated tranlog begin now

EXTRACT (Integrated) added.

GGSCI (rac01.localdomain) 11> add exttrail ./dirdat/onprem/lt extract ext3

EXTTRAIL added.

GGSCI (rac01.localdomain) 12> add extract pump3 exttrailsource ./dirdat/onprem/lt

EXTRACT added.

GGSCI (rac01.localdomain) 13> add rmttrail ./dirdat/onprem/rt extract pump3

RMTTRAIL added.

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 24> register extract ext3 database container (pdb1)

2019-02-11 17:57:40 INFO OGG-02003 Extract EXT3 successfully registered with database at SCN 10757064.

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 25> edit params ext3

EXTRACT ext3

SETENV (ORACLE_HOME='/acfs_oh/product/12.2.0/dbhome_1')

USERIDALIAS oggadmin_cdb1

EXTTRAIL ./dirdat/onprem/lt

SOURCECATALOG pdb1

TABLE demo.*;

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 27> edit params pump3

EXTRACT pump3

SETENV (ORACLE_HOME='/acfs_oh/product/12.2.0/dbhome_1')

USERIDALIAS oggadmin_cdb1

RMTHOST 129.150.93.188 , MGRPORT 7809, SOCKSPROXY 127.0.0.1:8088

RMTTRAIL ./dirdat/onprem/rt

SOURCECATALOG pdb1

TABLE demo.*;

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 28> shell mkdir ./dirdat/onprem

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 29> start extract ext3

Sending START request to MANAGER ...

EXTRACT EXT3 starting

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 35> info ext3

EXTRACT EXT3 Last Started 2019-02-11 18:08 Status RUNNING

Checkpoint Lag 00:00:03 (updated 00:00:00 ago)

Process ID 8488

Log Read Checkpoint Oracle Integrated Redo Logs

2019-02-11 18:14:11

SCN 0.10792986 (10792986)

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 36> start pump3

Sending START request to MANAGER ...

EXTRACT PUMP3 starting

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 42> info pump3

EXTRACT PUMP3 Last Started 2019-02-11 18:15 Status RUNNING

Checkpoint Lag 00:00:00 (updated 00:00:06 ago)

Process ID 14637

Log Read Checkpoint File /acfs_oh/app/goldengate/dirdat/onprem/lt000000000

2019-02-11 18:16:15.000000 RBA 21404

Configure the Cloud Replicat process

[opc@ggcsinst-ggcs-1 ~]$ sudo su - oracle

Last login: Thu Feb 7 06:53:41 UTC 2019 on pts/0

[oracle@ggcsinst-ggcs-1 ~]$ cd $GGHOME

[oracle@ggcsinst-ggcs-1 gghome]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 12.2.0.2.2 27274916_FBO

Linux, x64, 64bit (optimized), Oracle 12c on Dec 16 2017 03:36:13

Operating system character set identified as UTF-8.

Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved.

GGSCI (ggcsinst-ggcs-1) 1> info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

JAGENT STOPPED

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 9> dblogin useridalias ggadmin

Successfully logged into database PDB1.

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 11> add checkpointtable C##GGADMIN.chkptab

Logon catalog name PDB1 will be used for table specification PDB1.C##GGADMIN.chkptab.

Successfully created checkpoint table PDB1.C##GGADMIN.chkptab.

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 13> edit params ./GLOBALS

ENABLEMONITORING

CHECKPOINTTABLE C##GGADMIN.CHKPTAB

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 7> exit

[oracle@ggcsinst-ggcs-1 gghome]$ ./ggsci

GGSCI (ggcsinst-ggcs-1) 1> add replicat rep1 exttrail ./dirdat/onprem/rt

REPLICAT added.

GGSCI (ggcsinst-ggcs-1) 3> edit params rep1

REPLICAT rep1

USERIDALIAS ggadmin

MAP pdb1.demo.*, TARGET pdb1.demo.*;

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 13> start replicat rep1

Sending START request to MANAGER ...

REPLICAT REP1 starting

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 10> info rep1

REPLICAT REP1 Last Started 2019-02-11 10:21 Status RUNNING

Checkpoint Lag 00:00:18 (updated 00:00:02 ago)

Process ID 101632

Log Read Checkpoint File /u02/data/gg123ora12/dirdat/onprem/rt000000000

2019-02-11 10:21:19.695712 RBA 26366

Test replication between on-premise database and Oracle Cloud

Oracle Cloud Database

Note the number of rows in the MYOBJEC TS table.

[oracle@OGGDB ~]$ sqlplus demo/oracle@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Mon Feb 11 10:22:03 2019

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Last Successful login time: Mon Feb 11 2019 10:18:56 +00:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select count(*) from myobjects;

COUNT(*)

----------

0

On-premise Database

Note the number of rows in the MYOBJEC TS table.

[oracle@rac01 goldengate]$ sqlplus demo/oracle@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Mon Feb 11 18:22:41 2019

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Last Successful login time: Mon Feb 11 2019 18:17:28 +08:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select count(*) from myobjects;

COUNT(*)

----------

0

Insert rows into the MYOBJECTS table

SQL> insert into myobjects select * from all_objects where owner='HR';

41 rows created.

SQL> commit;

Commit complete.

Verify on-premise Extract has captured the changes

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 45> stats ext3 latest table pdb1.demo.myobjects

Sending STATS request to EXTRACT EXT3 ...

Start of Statistics at 2019-02-11 18:25:39.

Output to ./dirdat/onprem/lt:

Extracting from PDB1.DEMO.MYOBJECTS to PDB1.DEMO.MYOBJECTS:

*** Latest statistics since 2019-02-11 18:11:09 ***

Total inserts 41.00

Total updates 0.00

Total deletes 0.00

Total discards 0.00

Total operations 41.00

End of Statistics.

GGSCI (rac01.localdomain as C##oggadmin@cdb1_2/CDB$ROOT) 46> stats pump3 latest table pdb1.demo.myobjects

Sending STATS request to EXTRACT PUMP3 ...

Start of Statistics at 2019-02-11 18:26:02.

Output to ./dirdat/onprem/rt:

Extracting from PDB1.DEMO.MYOBJECTS to PDB1.DEMO.MYOBJECTS:

*** Latest statistics since 2019-02-11 18:15:32 ***

Total inserts 41.00

Total updates 0.00

Total deletes 0.00

Total discards 0.00

Total operations 41.00

End of Statistics.

Oracle GoldenGate Cloud Service environment

Verify GGSC Replicat has applied the changes

GGSCI (ggcsinst-ggcs-1 as c##ggadmin@OGGDB/PDB1) 19> stats rep1 latest

Sending STATS request to REPLICAT REP1 ...

Start of Statistics at 2019-02-11 10:27:26.

Replicating from PDB1.DEMO.MYOBJECTS to PDB1.DEMO.MYOBJECTS:

*** Latest statistics since 2019-02-11 10:27:18 ***

Total inserts 41.00

Total updates 0.00

Total deletes 0.00

Total discards 0.00

Total operations 41.00

End of Statistics.

Oracle Cloud Database

Note the number of rows which are now present in the MYOBJEC TS table.

[oracle@OGGDB ~]$ sqlplus demo/oracle@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Mon Feb 11 10:28:02 2019

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Last Successful login time: Mon Feb 11 2019 10:22:03 +00:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select count(*) from myobjects;

COUNT(*)

----------

41

2