ORCHESTRATING ORACLE GOLDENGATE MICROSERVICES USING PL/SQL

Similar documents
Installation Instructions: Oracle XML DB XFILES Demonstration. An Oracle White Paper: November 2011

An Oracle White Paper November Primavera Unifier Integration Overview: A Web Services Integration Approach

Configuring Oracle Business Intelligence Enterprise Edition to Support Teradata Database Query Banding

Correction Documents for Poland

Oracle Secure Backup. Getting Started. with Cloud Storage Devices O R A C L E W H I T E P A P E R F E B R U A R Y

An Oracle White Paper September Security and the Oracle Database Cloud Service

Veritas NetBackup and Oracle Cloud Infrastructure Object Storage ORACLE HOW TO GUIDE FEBRUARY 2018

Using the Oracle Business Intelligence Publisher Memory Guard Features. August 2013

Oracle Data Provider for.net Microsoft.NET Core and Entity Framework Core O R A C L E S T A T E M E N T O F D I R E C T I O N F E B R U A R Y

Oracle CIoud Infrastructure Load Balancing Connectivity with Ravello O R A C L E W H I T E P A P E R M A R C H

Oracle Service Registry - Oracle Enterprise Gateway Integration Guide

April Understanding Federated Single Sign-On (SSO) Process

Creating Custom Project Administrator Role to Review Project Performance and Analyze KPI Categories

Loading User Update Requests Using HCM Data Loader

Oracle Cloud Applications. Oracle Transactional Business Intelligence BI Catalog Folder Management. Release 11+

An Oracle White Paper October Deploying and Developing Oracle Application Express with Oracle Database 12c

An Oracle White Paper July Methods for Downgrading from Oracle Database 11g Release 2

October Oracle Application Express Statement of Direction

Generate Invoice and Revenue for Labor Transactions Based on Rates Defined for Project and Task

Oracle Financial Consolidation and Close Cloud. What s New in the November Update (16.11)

Automatic Receipts Reversal Processing

Oracle Database 10g Release 2 Database Vault - Restricting the DBA From Accessing Business Data

Load Project Organizations Using HCM Data Loader O R A C L E P P M C L O U D S E R V I C E S S O L U T I O N O V E R V I E W A U G U S T 2018

Deploying the Zero Data Loss Recovery Appliance in a Data Guard Configuration ORACLE WHITE PAPER MARCH 2018

JD Edwards EnterpriseOne Licensing

Oracle Database Vault

August 6, Oracle APEX Statement of Direction

Oracle Financial Services Regulatory Reporting for US Federal Reserve Lombard Risk Integration Pack

An Oracle White Paper October The New Oracle Enterprise Manager Database Control 11g Release 2 Now Managing Oracle Clusterware

Oracle VM 3: IMPLEMENTING ORACLE VM DR USING SITE GUARD O R A C L E W H I T E P A P E R S E P T E M B E R S N

Oracle Best Practices for Managing Fusion Application: Discovery of Fusion Instance in Enterprise Manager Cloud Control 12c

Oracle Database Vault

Oracle Fusion Configurator

Oracle Enterprise Performance Reporting Cloud. What s New in September 2016 Release (16.09)

Using Oracle In-Memory Advisor with JD Edwards EnterpriseOne

An Oracle White Paper March How to Define an Importer Returning Error Messages to the Oracle Web Applications Desktop Integrator Document

Achieving High Availability with Oracle Cloud Infrastructure Ravello Service O R A C L E W H I T E P A P E R J U N E

Handling Memory Ordering in Multithreaded Applications with Oracle Solaris Studio 12 Update 2: Part 2, Memory Barriers and Memory Fences

Oracle DIVArchive Storage Plan Manager

Establishing secure connections between Oracle Ravello and Oracle Database Cloud O R A C L E W H I T E P A P E R N O V E M E B E R

Deep Dive into Automating Oracle GoldenGate using the New Microservices

Oracle Learn Cloud. Taleo Release 16B.1. Release Content Document

Oracle Enterprise Data Quality New Features Overview

Migrating VMs from VMware vsphere to Oracle Private Cloud Appliance O R A C L E W H I T E P A P E R O C T O B E R

Working with Time Zones in Oracle Business Intelligence Publisher ORACLE WHITE PAPER JULY 2014

Tutorial on How to Publish an OCI Image Listing

Establishing secure connectivity between Oracle Ravello and Oracle Cloud Infrastructure Database Cloud ORACLE WHITE PAPER DECEMBER 2017

Oracle Social Network

Best Practice Guide for Implementing VMware vcenter Site Recovery Manager 4.x with Oracle ZFS Storage Appliance

An Oracle White Paper October Release Notes - V Oracle Utilities Application Framework

Oracle Fusion Middleware 11g Oracle Access Manager Frequently Asked Questions June 2009

Oracle Privileged Account Manager

Profitability Application Pack Installation Guide Release

SETTING UP ORACLE ULTRA SEARCH FOR ORACLE PORTAL 10G (10.1.4)

Transitioning from Oracle Directory Server Enterprise Edition to Oracle Unified Directory

Benefits of an Exclusive Multimaster Deployment of Oracle Directory Server Enterprise Edition

Technical White Paper August Recovering from Catastrophic Failures Using Data Replicator Software for Data Replication

Oracle Fusion Middleware

Hard Partitioning with Oracle VM Server for SPARC O R A C L E W H I T E P A P E R J U L Y

Pricing Cloud: Upgrading to R13 - Manual Price Adjustments from the R11/R12 Price Override Solution O R A C L E W H I T E P A P E R A P R I L

An Oracle White Paper December, 3 rd Oracle Metadata Management v New Features Overview

Oracle Flashback Data Archive (FDA) O R A C L E W H I T E P A P E R M A R C H

Oracle NoSQL Database For Time Series Data O R A C L E W H I T E P A P E R D E C E M B E R

Oracle NoSQL Database Parent-Child Joins and Aggregation O R A C L E W H I T E P A P E R A P R I L,

Oracle Learn Cloud. What s New in Release 15B.1

Oracle Financial Consolidation and Close Cloud. What s New in the December Update (16.12)

Technical White Paper August Migrating to Oracle 11g Using Data Replicator Software with Transportable Tablespaces

Oracle Express CPQ for Salesforce.com

Oracle Virtual Directory 11g Oracle Enterprise Gateway Integration Guide

An Oracle White Paper February Combining Siebel IP 2016 and native OPA 12.x Interviews

Oracle Forms Services Oracle Traffic Director Configuration

Leverage the Oracle Data Integration Platform Inside Azure and Amazon Cloud

Oracle Access Manager 10g - Oracle Enterprise Gateway Integration Guide

Oracle Financial Consolidation and Close Cloud. What s New in the February Update (17.02)

New Oracle NoSQL Database APIs that Speed Insertion and Retrieval

See What's Coming in Oracle Taleo Business Edition Cloud Service

Oracle Data Masking and Subsetting

Siebel CRM Applications on Oracle Ravello Cloud Service ORACLE WHITE PAPER AUGUST 2017

WebCenter Portal Task Flow Customization in 12c O R A C L E W H I T E P A P E R J U N E

Product Release Notes

Oracle Clusterware 18c Technical Overview O R A C L E W H I T E P A P E R F E B R U A R Y

Oracle Profitability and Cost Management Cloud. November 2017 Update (17.11) What s New

An Oracle White Paper March Oracle Database Vault for SAP

An Oracle Technical Article March Certification with Oracle Linux 4

RAC Database on Oracle Ravello Cloud Service O R A C L E W H I T E P A P E R A U G U S T 2017

TABLE OF CONTENTS DOCUMENT HISTORY 3

Integrating Oracle SuperCluster Engineered Systems with a Data Center s 1 GbE and 10 GbE Networks Using Oracle Switch ES1-24

Deploying Custom Operating System Images on Oracle Cloud Infrastructure O R A C L E W H I T E P A P E R M A Y

Technical Upgrade Guidance SEA->SIA migration

Oracle Enterprise Performance Reporting Cloud. What s New in the November Update (16.11)

Handling Memory Ordering in Multithreaded Applications with Oracle Solaris Studio 12 Update 2: Part 1, Compiler Barriers

Deploy VPN IPSec Tunnels on Oracle Cloud Infrastructure. White Paper September 2017 Version 1.0

Oracle Service Cloud Agent Browser UI. November What s New

Oracle Taleo Cloud for Midsize (Taleo Business Edition) Release 17B2. What s New

SonicMQ - Oracle Enterprise Gateway Integration Guide

Migration Best Practices for Oracle Access Manager 10gR3 deployments O R A C L E W H I T E P A P E R M A R C H 2015

Extreme Performance Platform for Real-Time Streaming Analytics

Bastion Hosts. Protected Access for Virtual Cloud Networks O R A C L E W H I T E P A P E R F E B R U A R Y

Oracle Communications Interactive Session Recorder and Broadsoft Broadworks Interoperability Testing. Technical Application Note

Oracle FLEXCUBE Direct Banking Release Dashboard Widgets Transfer Payments User Manual. Part No. E

Transcription:

ORCHESTRATING ORACLE GOLDENGATE MICROSERVICES USING PL/SQL Copyright 2018 Oracle and/or its affiliates. All rights reserved. 1

Contents 1 INTRODUCTION... 3 2 PREREQUISITES... 4 3 BACKGROUND... 5 3.1 OGG NEW ARCHITECTURE... 5 3.2 OGG INSTALLATION AND DEPLOYMENT... 5 3.3 OGG REST API... 5 4 SAMPLE ORCHESTRATION SCRIPT... 6 4.1 ADD_ONEWAY_REPLICATION USAGE... 6 4.1.1 SETUP ONE-WAY REPLICATION... 7 4.1.2 SETUP BI-DIRECTIONAL REPLICATION... 9 4.2 MANAGING REPLICATION COMPONENTS... 11 4.2.1 GET EXTRACT DETAILS... 11 4.2.2 UPDATE EXTRACT PARAMETER FILE... 12 4.2.3 STOP EXTRACT... 14 4.2.4 DELETE EXTRACT... 14 5 TROUBLESHOOTING... 15 6 CONCLUSION... 16 7 APPENDIX - I... 16 8 APPENDIX - II... 17 9 APPENDIX - III... 18 10 REFERENCES... 19 Copyright 2018 Oracle and/or its affiliates. All rights reserved. 2

1 INTRODUCTION Oracle GoldenGate (OGG) Microservices Architecture is a new architecture that provides REST-enabled services as part of the OGG environment. This document assumes that the reader is familiar with the concepts and features of the OGG Microservices Architecture. The REST-enabled services enable remote configuration, administration, and monitoring through HTML5 web pages, command line, and APIs The concepts, scripts and information presented 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. Before applying any changes presented in this article it should be thoroughly tested to assess functionality and performance implications PL/SQL can also be used to invoke the REST API's to manage OGG Microservices. UTL_HTTP is a PL/SQL package that enables making HTTP(S) calls using PL/SQL. This demo is built on UTL_HTTP to make REST calls to OGG deployments. This document outlines how to setup one-way replication and bidirectional replication, between a source and a target database. The example provided utilizes an orchestration Database to make the REST calls via PL/SQL to setup replication, however, the use of a separate orchestration database is optional. The example will walk through how to create all of the components for replication, such as EXTRACT, DISTRIBUTION PATH and a REPLICAT and start them from the remote orchestration database. An outline for managing or querying the created components, such as stopping EXTRACT or modifying EXTRACT parameter file, will also be demonstrated. An overview of the setup used for this demo Copyright 2018 Oracle and/or its affiliates. All rights reserved. 3

Figure-1 The legend for Figure-1 is given below: ggorch OGG orchestration user in orchestration database ggadmin OGG replication admin user in replication database repdb1, repdb2 Names of replication databases Port 9900 Service Manager port of OGG deployment gg_repdb1, gg_repdb2 Deployment names in the OGG deployment alias:repdb1, alias:repdb2 Alias names of the credentials in the OGG deployment. 2 PREREQUISITES The demo orchestration script assumes the following setup as shown in Figure-1: Machine-1 has a database with version 12.2 or higher. The demo script is to be installed in this orchestration database. Machine-2 has a replication database setup and Oracle GoldenGate Microservices deployed Machine-3 has a replication database setup and Oracle GoldenGate Microservices deployed. Note: In order to try the demo, the entire setup of the databases and the Oracle GoldenGate deployments can be hosted in the same machine. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 4

3 BACKGROUND 3.1 OGG NEW ARCHITECTURE The Oracle GoldenGate Microservices Architecture (MA) is based on Representational State Transfer Application Programming Interface (REST API). It allows configuring, monitoring, and managing Oracle GoldenGate services using a web-based interface, command line, or REST APIs. In contrast to OGG classic architecture, OGG Microservices architecture has different processes such as Service Manager, adminsrvr, distsrvr and recvsrvr (see Components of Oracle GoldenGate Microservices Architecture). 3.2 OGG INSTALLATION AND DEPLOYMENT The Getting Started with Oracle GoldenGate Microservices Architecture document details the steps for setting up replication using the new architecture. The deployments can be secure (https based) or non-secure (http based). The security model for the OGG REST API's requires both Authentication and Authorization. More details of the security model can be found in the documentation for Setting Up Secure or Non-Secure Deployments and Securing The Oracle GoldenGate Environment. Secure deployments use a certificate authority (CA) certificate, issued by Verisign, to enable clients to connect securely to the server. Please note: a) Certificates issued by CA's other than Verisign can also be used b) Self Signed certificates can also be used. You can use ORAPKI to generate self-signed certificates for testing. The sample code provided along with this document is only for Secure OGG deployments (i.e. HTTPS) that are configured for certificate based Authentication and Authorization. 3.3 OGG REST API OGG REST API is used to manage OGG deployments and replication services. You can create, modify, remove or query the OGG components. The prerequisites for using the REST API are mentioned in the QuickStart section of the OGG documentation. Each Oracle GoldenGate Service (ServiceManager, adminsrvr, distsrvr, recvsrvr) runs on a separate port. The OGG REST resources can be accessed using the following URL structure: http://localhost:port/or https://localhost:port/ where localhost and port are where OGG service is running. OGG can also be configured with reverse proxy at port 443 for secure (HTTPS) setup. The ports of individual services need not be remembered when using reverse proxy. More about OGG REST API can be found in the documentation About the REST APIs and Reverse Proxy Support documentation gives more information about reverse proxy setup. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 5

4 SAMPLE ORCHESTRATION SCRIPT The sample code is structured as below Figure-2 4.1 ADD_ONEWAY_REPLICATION USAGE ADD_ONEWAY_REPLICATION OGGSERVICE OGGHTTP A sample standalone PL/SQL function that sets up a simple one-way replication between a source database and a target database for the specified tables. This uses the underneath provided functions from OGGSERVICE. Package that illustrates how different actions can be performed on a given OGG deployment using REST calls. The actions are - Create component - Modify component - Remove component - Query component This uses OGGHTTP packages. Each action performs the following : 1. Construct the URL for the action 2. Construct the payload for the action 3. Make the HTTP call using the URL and the payload 4. Handle the response. Package that illustrates a way to make secure HTTP calls using UTL_HTTP. ADD_ONEWAY_REPLICAION is a sample standalone PL/SQL function that sets up a simple one-way replication between a source database and a target database for the specified tables. This uses the underneath provided functions from OGGSERVICE. The replication setup instruction assumes that there are three machines (refer to Figure-1 above) Orchestration DB site Orchestration Database is created where the sample orchestration script is installed as database user GGORCH. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 6

The client certificate to connect to the OGG deployments is available inside a wallet placed under the directory $ORACLE_HOME/admin/ggorch_wallet. The user name specified in the client certificate is authorized to make REST API calls to both the OGG deployments in REPDB1 site and REPDB2 site mentioned below. REPDB1 Site Replication database repdb1 setup for acting as replication source Secure OGG deployment is setup with ServiceManager listening on port 9900 dblogin credential alias, repdb1, is created with domain as OracleGoldenGate, in the admin server credential store of OGG deployment OGG Deployment gg_repdb1 is created REPDB2 Site Replication database repdb2 is setup for acting as replication target Secure OGG deployment is setup with ServiceManager listening on port 9900 dblogin credential alias, repdb2, is created with domain as OracleGoldenGate, in the admin server credential store of OGG deployment OGG Deployment gg_repdb2 is created The following steps are to be performed in the orchestration database to configure the GGORCH user. SQL> connect sys as sysdba SQL> grant dba to ggorch identified by <password>; SQL> @oggorch_setup ggorch <absolute_path_to_client_certificate> SQL> connect ggorch SQL> @orchestration_db_setup.sql Note: <absolute_path_to_client_certificate> can be skipped if the directory $ORACLE_HOME/admin/ggorch_wallet directory is created in the orchestration database and the client wallet copied into it. This is the default directory that will be used by the script to look for the client wallet. 4.1.1 SETUP ONE-WAY REPLICATION add_oneway_replication FUNCTION sets up a one-way replication between the SCOTT schema and HR schema of the databases repdb1 and repdb2. The key inputs to this function are - Source OGG deployment - Source database OGG alias - Target OGG deployment - Target database OGG alias - List of tables to be replicated It can optionally take inputs for instantiating the target tables (see add_oneway_replication) This function uses REST calls to retrieve information about the adminsrvr, distsrvr and recvsrvr running in the OGG deployments. It then creates the following replication components from the remote Orchestration database using REST calls - Extract in the source OGG deployment. - Distribution path between source and target OGG deployment - Replicat in the target OGG deployment. The parameter files of Extract and Replicat is configured to replicate the provided list of tables. OGG Deployment in REPDB1 Site - Creates and start an EXTRACT - Creates and start a DISTRIBUTION PATH to OGG deployment in REPDB2 site OGG Deployment in REPDB2 Site - Creates and start a REPLICAT Copyright 2018 Oracle and/or its affiliates. All rights reserved. 7

Figure-3 CREATE ONE WAY REPLICATION FROM REPDB1 DATABASE TO REPDB2 DATABASE. The following code needs to be executed as GGORCH in the orchestration database (see add_oneway_replication ). This creates a one-way replication between databases referenced by the aliases repdb1 and repdb2 with former as the source and latter as the target. The resulting setup replicates scott schema and hr schema from source to target. set serverout on DECLARE response_info clob; ret number; BEGIN ret := add_oneway_replication( ogg_source => ogg_connection( &machine2, 9900, gg_repdb1 ), source_dblogin_credential_alias => 'repdb1', ogg_target => ogg_connection( &machine3, 9900, gg_repdb2 ), target_dblogin_credential_alias => 'repdb2, tables => '"scott.*", hr.* ', END; / response_info => response_info); The output below shows that Extract EFIML, Distribution path PFIML and replicat RFIML are created. The Extract and Distribution path are shown to be running in the SOURCE OGG DEPLOYMENT and the replicat is starting in the TARGET OGG DEPLOYMENT. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 8

OUTPUT ---------------- REPLICATION:REPDB1 =>REPDB2 ------------------- ---------------- EXTRACT ------------------- EXTRACT (Integrated) added. Extract EFIML successfully registered with database at SCN 4623804. EXTTRAIL added. EXTRACT EFIML starting EXTRACT EFIML started ---------------- DISTRIBUTION PATH ------------------- The path 'PFIML' has been added. ---------------- REPLICAT ------------------- REPLICAT (Integrated) added. REPLICAT RFIML starting REPLICAT RFIML started ---------- SOURCE OGG DEPLOYMENT --------- Group Status Program EFIML : "running"] - EXTRACT PFIML : "running"] - PATH ---------- TARGET OGG DEPLOYMENT --------- Group Status Program RFIML : "starting"] - REPLICAT Note: The names are like E<suffix> for EXTRACT, R<suffix> for REPLICAT and P<suffix> for DISTRIBUTION PATH, where <suffix> is a random generated 4 character sequence. 4.1.2 SETUP BI-DIRECTIONAL REPLICATION The above setup can be made bi-directional replication between the SCOTT schema and HR schema of the databases repdb1 and repdb2 by making another call to add_oneway_replication by exchanging the source and target details. An additional call to create replication in the reverse direction does the following: OGG Deployment in REPDB2 Site - Creates and start an EXTRACT - Creates and start a DISTRIBUTION PATH to OGG deployment in REPDB1 site OGG Deployment in REPDB1 Site - Creates and start a REPLICAT Copyright 2018 Oracle and/or its affiliates. All rights reserved. 9

Figure-4 BI-DIRECTIONAL REPLICATION FROM REPDB2 DATABASE TO REPDB1 DATABASE. The following code need to be executed as GGORCH in the orchestration database. This creates a one-way replication between databases referenced by the aliases repdb2 and repdb1 with former as the source and latter as the target. The resulting setup replicates scott schema and hr schema from source to target. This step, combined with the earlier step, creates a bi-directional setup between repdb1 and repdb2 for scott and hr schemas. set serverout on DECLARE response_info clob; ret number; BEGIN ret := add_oneway_replication( ogg_source => ogg_connection( &machine3,9900, gg_repdb1 ), source_dblogin_credential_alias => 'repdb2', ogg_target => ogg_connection( &machine2,9900, gg_repdb2 ), target_dblogin_credential_alias => 'repdb1, tables => '"scott.*", hr.* ', END; / response_info => response_info); The output below shows that Extract EFCUG, Distribution path PFCUG and replicat RFCUG are created. The Extract and Distribution path are shown to be running in the SOURCE OGG DEPLOYMENT and the replicat is starting in the TARGET OGG DEPLOYMENT. The replication components EFIML, PFIML, RFIML created in the earlier steps may also be seen in the output. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 10

OUTPUT ---------------- REPLICATION:REPDB2 =>REP DB1 ------------------- ---------------- EXTRACT ------------------- EXTRACT (Integrated) added. Extract EFCUG successfully registered with database at SCN 4624869. EXTTRAIL added. EXTRACT EFCUG starting EXTRACT EFCUG started ---------------- DISTRIBUTION PATH ------------------- The path 'PFCUG' has been added. ---------------- REPLICAT ------------------- REPLICAT (Integrated) added. REPLICAT RFCUG starting REPLICAT RFCUG started ---------- SOURCE OGG DEPLOYMENT --------- Group Status Program EFCUG : "running"] - EXTRACT RFIML : "running"] - REPLICAT PFCUG : "running"] - PATH ---------- TARGET OGG DEPLOYMENT --------- Group Status Program EFIML : "running"] - EXTRACT RFCUG : "starting"] - REPLICAT PFIML : "running"] PATH 4.2 MANAGING REPLICATION COMPONENTS Once the replication components are created using add_oneway_replication they can be updated, started, stopped or removed. The examples below show a few actions that can be performed on Extract. Similar actions can be performed on other replication components as appropriate. 4.2.1 GET EXTRACT DETAILS The below code will get the extract details of the extract &extract_name under OGG deployment gg_repdb2 on machine &machine3 listening on port 9900 set serverout on DECLARE response_info CLOB; ret NUMBER; BEGIN ret := OGGSERVICE.get_extract_details( ogg_instance => ogg_connection( &machine3,9900, gg_repdb2 ), extract_name => '&extract_name', response_info => response_info); pretty_json(response_info); END; / The OUTPUT shown below are the details fetched for the extract EFCUG. It may be noted that this shows the status as running and the source attribute says it is an integrated extract. The entire parameter file of the extract can also be seen in the config attribute. The json schema of this output can be found in the docs. OUTPUT "messages" : ] Copyright 2018 Oracle and/or its affiliates. All rights reserved. 11

], "response" : "$schema" : "ogg:extract", "credentials" : "alias" : "repdb2", "domain" : "OracleGoldenGate" "begin" : "now", "targets" : "name" : "jq", "sizemb" : 500, "sequencelength" : 9, "sequencelengthflip" : false, "sequence" : 0, "offset" : 31556912, "remote" : false } ], "config" : "extract EFCUG;", "useridalias repdb2 domain OracleGoldenGate", "exttrail jq", "table scott.*;", "table hr.*;" ], "description" : "EFCUG", "source" : "tranlogs" : "integrated" "registration" : "csn" : 4624869, "share" : true "status" : "running" } ] } ] 4.2.2 UPDATE EXTRACT PARAMETER FILE The lines of EXTRACT parameter file is presented as a JSON array (see config in the OUTPUT of section 4.2.1) in the REST API payload. This example updates the parameter file of an EXTRACT by adding an additional line to the existing parameter file. This is done by first retrieving the existing parameters of the EXTRACT and adding the new parameter to the existing list and updating the parameter file with the revised list of lines. The below code updates the parameter file of extract &extract_name under the OGG deployment gg_repdb2 on machine &machine3 listening on port 9900 set serverout on DECLARE response_info CLOB; ret NUMBER; ogg_deployment OGG_CONNECTION; config_jarray JON_ARRAY_T; config_str VARCHAR2(4000); BEGIN ogg_deployment := ogg_connection( &machine3,9900, gg_repdb2 ); /* Get the existing parameters for the extract */ ret := OGGSERVICE.get_extract_details( ogg_instance => ogg_deployment, extract_name => '&extract_name, response_info => response_info); Copyright 2018 Oracle and/or its affiliates. All rights reserved. 12

config_jarray := JSON_ARRAY_T.PARSE(JSON_QUERY(response_info, '$.response.config')); /* Add the new parameter to the existing set of parameters */ config_jarray.append('ddloptions ADDTRANDATA RETRYOP RETRYDELAY 10 MAXRETRIES 10'); /* Remove the brackets from the JSON array */ config_str := config_jarray.to_string; config_str := replace(replace(config_str,'',''),']',''); /* Update the revised parameters of the extract */ ret := OGGSERVICE.update_extract( ogg_instance => ogg_deployment, extract_name => '&extract_name, extract_params => config_str, response_info => response_info); /* If the update is successful then retrieve the extract details to check if the update went through */ IF ret!= OGGHTTP.resp_success THEN pretty_json(response_info); ELSE ret := OGGSERVICE.get_extract_details( ogg_instance => ogg_deployment, extract_name => '&extract_name, response_info => response_info); Pretty_json(response_info); END IF; END; / The OUTPUT shown below displays the effect of parameter file update for the extract EFCUG. It may be noted that this shows the line DDLOPTIONS ADDTRANDATA RETRYOP RETRYDELAY 10 MAXRETRIES 10 added to the parameter file. (Refer to OUTPUT of section 4.2.1 for the parameter file before this update) OUTPUT "messages" : ] ], "response" : "$schema" : "ogg:extract", "credentials" : "alias" : "repdb2", "domain" : "OracleGoldenGate" "begin" : "now", "targets" : "name" : "jq", "sizemb" : 500, "sequencelength" : 9, "sequencelengthflip" : false, "sequence" : 0, "offset" : 31556912, "remote" : false } ], "config" : "extract EFCUG;", "useridalias repdb2 domain OracleGoldenGate", "exttrail jq", "table scott.*;", "table hr.*;", "DDLOPTIONS ADDTRANDATA RETRYOP RETRYDELAY 10 MAXRETRIES 10" ], Copyright 2018 Oracle and/or its affiliates. All rights reserved. 13

"description" : "EFCUG", "source" : "tranlogs" : "integrated" "registration" : "csn" : 4624869, "share" : true "status" : "running" } ] } ] 4.2.3 STOP EXTRACT The below code stops the extract &extract_name under the OGG deployment gg_repdb2 on &machine3 listening on port 9900. set serverout on DECLARE response_info clob; ret number; BEGIN ret := OGGSERVICE.STOP_EXTRACT( ogg_instance => ogg_connection( &machine3,9900, gg_repdb2 ), extract_name => &extract_name, response_info => response_info); END; / pretty_json(response_info); The OUTPUT shown below is for the extract EFCUG. It says that the extract is stopped. OUTPUT "messages" : "$schema" : "ogg:message", "title" : "EXTRACT EFCUG stopped", "code" : "OGG-00975", "severity" : "INFO", "issued" : "2018-08-17T12:04:22Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-00975" "$schema" : "ogg:message", "title" : "EXTRACT EFCUG stopped", "code" : "OGG-15426", "severity" : "INFO", "issued" : "2018-08-17T12:04:22Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-15426" } ] ], "response" : " " } ] 4.2.4 DELETE EXTRACT The below code deletes the extract &extract_name under the OGG deployment gg_repdb2 on &machine3 listening on port 9900. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 14

set serverout on DECLARE response_info clob; ret number; BEGIN ret := OGGSERVICE.DELETE_EXTRACT( ogg_instance => ogg_connection( &machine3,9900, gg_repdb2 ), extract_name => &extract_name, response_info => response_info); pretty_json(response_info); END; / The OUTPUT below is for extract EFCUG. It may be noted that before deleting the extract it was unregistered from the database, as this is an integrated extract. Any rows corresponding to the extract in the heartbeat table is also deleted. OUTPUT "messages" : "$schema" : "ogg:message", "title" : "Sending STOP request to EXTRACT EFCUG ", "code" : "OGG-08100", "severity" : "INFO", "issued" : "2018-08-17T12:25:03Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-08100" "$schema" : "ogg:message", "title" : "EXTRACT EFCUG is down (gracefully)", "code" : "OGG-00979", "severity" : "INFO", "issued" : "2018-08-17T12:25:03Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-00979" "$schema" : "ogg:message", "title" : "Successfully unregistered EXTRACT EFCUG from database.", "code" : "OGG-01750", "severity" : "INFO", "issued" : "2018-08-17T12:25:14Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-01750" "$schema" : "ogg:message", "title" : "No Heartbeat entries with EFCUG], none deleted.", "code" : "OGG-14052", "severity" : "INFO", "issued" : "2018-08-17T12:25:14Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-14052" "$schema" : "ogg:message", "title" : "Deleted EXTRACT EFCUG.", "code" : "OGG-08100", "severity" : "INFO", "issued" : "2018-08-17T12:25:14Z", "type" : "http://docs.oracle.com/goldengate/c1910/gg-winux/gmesg/oggus.htm#ogg-08100" } ] ], "response" : " " } ] 5 TROUBLESHOOTING Following are some of the errors that might occur, when using the sample orchestration script and their possible Copyright 2018 Oracle and/or its affiliates. All rights reserved. 15

reasons. Error "file:$oracle_home/admin/ggorch_wallet is not configured for access to user: <USER>" ] } Possible Reason Access to wallet directory to the orchestration user is not granted. Sample code for granting access to wallet directory can be found in oggorch_setup.sql "title" : "The authorization information for <service> is missing, invalid or not properly formed.", ORA-29024: Certificate validation Failure ORA-24247: network access denied by access control list (ACL) ORA-28759: failure to open file Possibly the user name present in the certificate in $ORACLE_HOME/ggorch_wallet is not authorized to access the RESTAPI calls in the OGG deployment. The certificate placed in $ORACLE_HOME/ggorch_wallet is possibly not signed by a Certificate authority that is trusted by the OGG deployment. The DB admin user, where orchestration packages are installed, does not have privilege to make HTTPS calls. A sample code for granting HTTPS access to a user is given in oggorch_setup.sql Possibly no wallet is present in $ORACLE_HOME/admin/ggorch_wallet directory 6 CONCLUSION It may be noticed that the provided package does not exhaustively provide functions to perform all possible actions on the OGG Microservices deployment. It does not also provide different security modes of authentication. However, it may be easily extended to provide complete functional REST API client to maintain an OGG deployment, only using PL/SQL. 7 APPENDIX - I If the OGG deployments are configured with reverse proxy at port 443 then all the examples given above needs the below modification ogg_connection( &machine2,9900, gg_repdb1 ) should be modified to ogg_connection( &machine2, gg_repdb1 ), e.g. set serverout on DECLARE response_info clob; ret number; BEGIN ret := OGGSERVICE.DELETE_EXTRACT( ogg_instance => ogg_connection( &machine2, gg_repdb1 ), extract_name => &extract_name, response_info => response_info); pretty_json(response_info); END; / If the reverse proxy is configured at a non-standard port then use the following modification ogg_connection( &machine2,9900, gg_repdb1 ) should be modified to ogg_connection( &machine2,&reverse_proxy_port, gg_repdb1, 1) e.g. set serverout on DECLARE response_info clob; ret number; BEGIN Copyright 2018 Oracle and/or its affiliates. All rights reserved. 16

ret := OGGSERVICE.DELETE_EXTRACT( ogg_instance => ogg_connection( &machine2, &reverse_proxy_port, gg_repdb1, 1), extract_name => &extract_name, response_info => response_info); pretty_json(response_info); END; / 8 APPENDIX - II The top level function that creates a one way replication between a source and target database is below: FUNCTION ADD_ONEWAY_REPLICATION ( ogg_source IN OGG_CONNECTION, db_source_alias IN VARCHAR2, ogg_target IN OGG_CONNECTION, db_target_alias IN VARCHAR2, tables IN VARCHAR2, response_info OUT CLOB) Parameter ogg_source db_source_alias ogg_target db_target_alias tables Description Connection details of source ogg deployment Alias to the source database created in the ogg_source_deployment Connection details of target ogg deployment Alias to the target database created in the ogg_target_deployment Comma separated list of tables and schemas to be replicated. SCOTT schema can be specified as SCOTT.* EMP table in SCOTT schema can be specified as SCOTT.EMP. e.g 'SCOTT.*, USER1.TAB, USER2.*' response_info The above string sets up replication between SCOTT schema from source to target USER2 schema from source to target USER1.TAB table in source to USER1.TAB table in target response message from OGG server. There are a number of configuration variables inside the FUNCTION that can be used to customize it for different requirements. Wherever names are required (extract, replicat, path, trail) they are generated, if NULL. The following variables can be initialized with desired value so that the initialized value is used instead of generating them. extract_name VARCHAR2(5) := ''; extract_mode VARCHAR2(20) := 'integrated'; path_name VARCHAR2(5) := ''; replicat_name VARCHAR2(5) := ''; replicat_mode VARCHAR2(20) := 'integrated'; source_trail VARCHAR2(2) := ''; source_trail_path VARCHAR2(2) := ''; target_trail VARCHAR2(2) := ''; target_trail_path VARCHAR2(2) := ''; extract_params_template VARCHAR2(4000) := '"extract <extract_name>;",' '"useridalias <db_alias> domain OracleGoldenGate",' '"exttrail <extract_trail>",' '<tables_stmt>' ; replicat_params_template VARCHAR2(4000) := '"replicat <replicat_name>;",' '"useridalias <db_alias> domain OracleGoldenGate",' '<map_stmt>'; Copyright 2018 Oracle and/or its affiliates. All rights reserved. 17

9 APPENDIX - III The replication objects of the target database can be instantiated from the replication objects of the source database using the package OGGINSTANTIATE that is provided in the file ogginstantiate.sql The user, executing the package OGGINSTANTIATE, needs to have the following privileges grant execute on dbms_datapump to <user> grant create table to <user> The OGGINSTANTIATE package needs to be executed from the target replication database before setting up the replication. Instantiation is done by importing objects from the source database using a database link. The package OGGINSTANTIATE is built using the code provided in the DBMS_DATAPUMP API examples. The signature of the only procedure provided by OGGINSTANTIATE is given below /* PROCEDURE instantiate Instantiates the target schema/table using the schema/table in the source INPUT source_obj target_obj - Source object to be used for instantiation can be of the form *.* for Full database instantiation. 'SCOTT.*' for schema instantiation or 'SCOTT.EMP' for table instantiation - Target object to be used for instantiation can be of the form *.* for Full database instantiation, 'SCOTT.*' for schema instantiation or 'SCOTT.EMP' for table instantiation source_dblink - Database link to the source database */ ------------------------------------------------------------------------------- PROCEDURE instantiate(source_obj IN VARCHAR2, target_obj IN VARCHAR2, source_dblink IN VARCHAR2); ------------------------------------------------------------------------------- EXAMPLE 1 Instantiate the target database, from the source database, by doing a full database import. src_dblink is the database link to the source database sqlplus> set serverout on sqlplus> execute OGGINSTANTIATE.INSTANTIATE( *.*, *.*, src_dblink) EXAMPLE 2 Instantiate only scott schema of the target database from the scott schema of the source database. src_dblink is the database link to the source database sqlplus> set serverout on sqlplus> execute OGGINSTANTIATE.INSTANTIATE( scott.*, scott.*, src_dblink) Note: If target_obj is specified as hr.* instead of scott.* then the scott schema of source database will be imported into hr schema of the target. EXAMPLE 3 Instantiate only scott.emp table of the target database with the scott.emp table of the source database src_dblink is the database link to the source database sqlplus> set serverout on sqlplus> execute OGGINSTANTIATE.INSTANTIATE( scott.emp, scott.emp, src_dblink) Note: If target_obj is specified as hr.emp instead of scott.emp then the scott.emp table of source database will be imported into hr.emp table of the target. Copyright 2018 Oracle and/or its affiliates. All rights reserved. 18

In all the above cases, if the object that is being imported from the source database exists on the target database then the object will not be imported. 10 REFERENCES 1] Oracle GoldenGate Microservices Architecture 2] Self-signed Certificate creation 3] Setting Up Secure or Non-Secure Deployments 4] Components of Oracle GoldenGate Microservices Architecture 5] OGG Microservices REST API Reference guide 6] Securing Oracle GoldenGate Environment 7] UTL_HTTP Copyright 2018 Oracle and/or its affiliates. All rights reserved. 19

Oracle Corporation, World Headquarters Worldwide Inquiries 500 Oracle Parkway Phone: +1.650.506.7000 Redwood Shores, CA 94065, USA Fax: +1.650.506.7200 Orchestration Utilities for Oracle GoldenGate Microservices using PL/SQL Oct 2018 Author: Parthasarathy Raghunathan Copyright 2018, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 1018 Copyright 2018 Oracle and/or its affiliates. All rights reserved. 20