Tuesday, August 4, 2020

ORACLE GOLDEN GATE 12 C



ORACLE GOLDEN GATE 12 C
------------------------------------------

Introduction :
---------------

Oracle GoldenGate is a software produces that allows you to replicate,filter and transform the data from one database to another database. it enables the replication of data between oracle databases and other supported heterogenous databases,Goldengate is designed for real time,change data capture routing and delivery it performs basic,row level transformationsOracle goldengate 12c enables the continuos,realtime capture,routing,transformation,and delivery of Transactional data across heterogenous environments,as new or updated data is commited at the source system,it is continuosly captured and applied to one or more target systems with low latency


Golden gate Architecture
-------------------------------

chaitanyaoracledba blog



Let us start the process
-------------------------

We have two environments one is prodb and another is devdb

This configuiration is to be done on both devdb and proddb

Before we install goldengate software we have to install the database 12c

Install 12c on GGPROD and create database us below option to install oracle 12c on GGPROD server

1. Installation option : install database software only

2.Single instance database installation

3.Enterprise Edition

4.Oracle Base :/u01/app/oracle

5.Software Location :/u01/app/oracle/product/12.1.0/db_home

6.Inventory Directory: /u01/app/orainventory 

7.orainventory Group Name :oinstall

8.Operating Systems groups :dba (set all to dba)

9.Proceed to install the database software


First we have to set the environment varibales ,start dbca and create proddb database 

Set below under bash_profile

export ORACLE_SID= proddb
export ORACLE_HOME=/u01/app/aoracle/product/12.1.0/db_home
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:=$ORACLE_HOME/bin

Open in vi editor bash_profile and save and quit

$exit
# su - oracle

env|grep ORA 

ORACLE_SID= proddb
ORACLE_HOME=/u01/app/aoracle/product/12.1.0/db_home

Next start using DBCA (Database configuration assistant)

1. Database Option: create database

2.Creation Mode :  Advanced Mode

3.Database Template: General purpose

4.Database  SID: proddb (Container database -uncheck/disabled)

5.Manageemnt Options :All options unchecked

6.Database Creddintilas :provide sys user password

7.Listener Configuration :uncheck we will configure listener manually

8.Storage Locations 

   a. User common locations for all database files
   b. Enable FRA with 20 gb size
   c. Enable archiving

9.Database Option :check sample schema     (here we will select in proddb environment but devdb do not check sample schema we will replication sample schema from proddb to devdb using golden gate )

10.Create Database

Install Oracle 12c Golden Gate on both the servers(devdb,and proddb)
------------------------------------------------------------------------------------

Oracle golden gate software ---->12.2.0.1

Copy the Golden gate installation Zip files on both the servers  under this directory /u02


Install Golden gate Software on GGPROD

Unzip the golden gate zip files

$ cd /u02
$ unzip fbo_ggs_Linux_x64_shipome.zip


Start installing Golden gate on GGPROD server

$ cd fbo_ggs_Linux_x64_shipome/Disk1

./runInstaller

oracle goldengate installation wizard will be started

select installation Option 

select the oracle Goldengate for oracle database 12c

After that Golden gate installation on both the servers

we have to start the replication process before we have to do 

Single table Initial Load and change sync

Database---> Proddb--->    schema---> Fox------>Table--->EMP 

Database----> Devdb---->   Schema----> Tom------>Table--->EMP


Let us create EMP table from SCOTT.EMP for fox user

proddb

sqlplus '/as sysdba'

sql>create table fox.emp as select * from scott.emp;

sql>alter table fox.emp add primary key ("EMPNO");

on the target database just create the EMP table with out any data into it generate the FOX.EMP table ddl command


proddb
sql> set heading off;
sql>set echo off;
sql>set pages 999;
set long 90000;
sql>select dbms_metadata.get_ddl('TABLE",'EMP','FOX') fro dual; (in the above output FOX TO TOM and execute this command GGDEV

Let us start the process
----------------------------

1.Create empty table(with out any data) on target database

2.set up goldengate initial load


3.Configure change sync(inserts,updates,deletes)

4.Delete initial load(EXT/REP)


Step 1 : Configure change sync for fox.emp table

connect to database via Goldengate


proddb

cd $ GG_HOME
./ggsci

ggsci>dblogin userid ogg .password ogg

suceesfully logged into database

> info all

>start mgr

add table level supplemental logging via Goldengate


ggprod

ggsci>add trandata FOX.EMP

logging of supplemental redo data enabled for table FOX.EMP
TRANDATA for scheduling columns has been added on table 'FOX.EMP'

GGPROD

GGSCI>ADD EXTRACT PFOXE1, INTEGRATED TRANLOG,BEGIN NOW EXTRACT(Integrated added) 

GGSCI>register extract PFOXE1 database


Create Local trail file for extract process

GGSCI> add exttrail /u01/app/oracle/product/gg/dirdat/pf,extract PFOXE1

Create parameter file for extract process

GGSCI> edit param PFOXE1

EXTRACT PFOXE1
USERID ogg,password OGG
EXTTRAIL /uo1/app/oracle/product/gg/dirdat/pf
TABLE FOX>EMP;

Create GG DP process   (here DP means datapump)

GGSCI> add extract PFOXD1,EXTTRAILSOURCE /u01/app/oracle/product/gg/dirdat/pf

Create Remote trail file for extract process

GGSCI>add rmttrail/u01/app/oracle/product/gg/dirdat/rf, extract PFOXD1

Create parameter file for data pump process

GGSCI> edit param  PFOXD1

EXTRACT PFOXD!
USERID ogg ,PASSWORD ogg
RMTHOST ggdev, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/gg/dirdat/rf
TABLE FOX.EMP;

Create CG REplicate on target

GGDEV

GGSCI>dblogin userid ogg,password ogg
GGSCI>add replicat DFOXR1, integrated exttrail /u01/app/oracle/product/gg/dirdat/rf

Create parameter file for replicat on target

GGSCI> edit param DFOXR1

REPLICAT DFOXR1
USERID ogg,PASSWORD ogg
ASSUMETARGETTDEFS
MAP FOX.EMP TARGET TOM.EMP;

Step 2:

Configure initial load extract and replicat
-------------------------------------------------

Add initial load EXtract on source

proddb
------

GGSCI> ADD EXTRACT INITLE,SOURCEISTABLE

eidt parameter file for initial load extract

GGSCI> EDIT PARAM INITLE

EXTRACT INITLE
userid ogg, password ogg
RMTHOST ggdev,mgrport 7809
RMTTASK REPLICAT,GROUP INITLR
TABLE FOX.EMP;

Add initial load Replicat on target

devdb
-----

GGSCI> ADD REPLICAT INITLR,SPECIALRUN

edit parameter file for initial load replicat

GGSCI> EDIT PARAM INITLR

REPLICAT INITLR
userid ogg,password ogg
ASSUMETARGETTDEFS
MAP FOX>EMP,TARGET TOM.EMP;


Step-3
------

Start Initial Load and change sync

Fisrt start the change sync extract and datapump on source,This will start capturing changes while we perform the initial load.(Do not start replicat at this point)


proddb
------
GGSCI>start PFOXE1
GGSCI>start PFOXD1

Now start the initial load extract (Remember this will automatically start the initial loadreplicat on)

GGSCI> start INITLE
GGSCI> INFO INITLE


verify on taget if all the 14 recorrds have been loaded on target table or not

devdb
-----

sqlplus '/as sysdba
select * from tom.emp;

now start the change sync replicat

devdb
----

GGSCI> start DFOXR1

note :At this stage ,youcan delete the initial load extarct and replicat process as they are no longer needed

if you get below error while starting the initial load extarct

2020-08-04 12:23:40 ERROR OGG-01201 ERROR reported by MGR
2020-08-04 12:23:40 ERROR OGG-O1668 ERROR PROCESS ABENDING

add below line to ggdev mgr

ACCESSRULE,PROG* IPADDR*,ALLOW

GGSCI> refresh mgr


Note: info on Goldengate it may be differ from your environment like production,testing,development using naming conventions,directory structures 


THANK YOU FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME










ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...