Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

A) Golden Gate Installation:

Below are DB information:

SQL> select name from v$database;

NAME
---------
GGSRC

SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;

SUPPLEME
--------
NO

SQL> archive log list


Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 3
Current log sequence 3
SQL>

Pre Installation

The below task are requried to be completed both in source and target Database prior
starting GoldenGate Installation

➢ Enabling Supplemental Logging and Force Logging:

It tells database to log more (supplemental logging ~10% of more redo writing) on
source side.
alter database add supplemental log data;
alter database force logging;
alter system switch logfile;

➢ Ensure database in archivelog mode

➢ Creating dedicated tablespace for OGG:

create tablespace OGG_TBS datafile '/disk1/ggsrc/ogg_tbs_01.dbf' size 100M;

➢ Creating GG user and privileges

create user gguser identified by oracle


default tablespace OGG_TBS
temporary tablespace temp;

➢ System Privileges for GG User

Grant unlimited tablespace to gguser;


grant select any dictionary to gguser;
grant flashback any table to gguser;
grant select on dba_clusters to gguser;
grant execute on dbms_flashback to gguser;
grant dba to gguser;
exec dbms_goldengate_auth.grant_admin_privilege('GGUSER');

Basically we need to ensure below privileges for OGG database user.


CREATE SESSION
ALTER SESSION
RESOURCE
CONNECT
SELECT ANY DICTIONARY
FLASHBACK ANY TABLE OR FLASHBACK ON <TABLENAME>
SELECT ANY TABLE
INSERT,UPDATE,DELETE ON <TABLENAME> --ONLY FOR REPLICATE
EXECUTE ON DBMS_FLASHBACK
SELECT ANY TRANSACTION
exec dbms_goldengate_auth.grant_admin_privilege('GGUSER');

Also we need below from 11.2.0.4


ENABLE_GOLDENGATE_REPLICATION=TRUE

➢ Below required for integrated Capture

Grant INSERT into logmnr_restart_ckpt$.


grant insert on system.logmnr_restart_ckpt$ to gguser;

Grant UPDATE on streams$_capture_process.


grant update on sys.streams$_capture_process to gguser;

Grant the 'become user' privilege.


grant become user to gguser;

1. Golden Gate Installation

 Creation of directory structure


[oracle@myserver 12.2c11]$ pwd
/disk1/ogg/12.2c11
 Setting up of Environment Variables

[oracle@myserver 12.2c11]$ cat setup_gg


export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ggsrc
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export SOFTWARE_LOCATION=/disk1/ogg/12.2c11
export PATH=$ORACLE_HOME/bin:$SOFTWARE_LOCATION:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$SOFTWARE_LOCATION

[oracle@myserver 12.2c11]$ source setup_gg

 Extracting the Golden gate binary files


unzip 121210_fbo_ggs_Linux_x64_shiphome.zip

Below is already extract software file:

[oracle@myserver Disk1]$ pwd


/disk2/12.2c11/fbo_ggs_Linux_x64_shiphome/Disk1
[oracle@myserver Disk1]$ ll
total 16
drwxr-xr-x 4 oracle oinstall 4096 Sep 4 17:03 install
drwxr-xr-x 2 oracle oinstall 4096 Sep 4 17:03 response
-rwxr-xr-x 1 oracle oinstall 918 Sep 4 17:03 runInstaller
drwxr-xr-x 11 oracle oinstall 4096 Sep 4 17:03 stage
ALT+I
ALT+C

2. Golden Gate Configuration

Setting up of env variable are important else ./ggsci


./ggsci goldengate software command interface
[oracle@myserver 12.2c11]$ pwd
/disk1/ogg/12.2c11
[oracle@myserver 12.2c11]$ ./ggsci
./ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file
or directory

Set up the Env variables


[oracle@myserver 12.2c11]$ source setup_gg
[oracle@myserver 12.2c11]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Jun 30 2017 14:42:26
Operating system character set identified as UTF-8.

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

GGSCI (myserver) 1>

View status of all golden gate processes using the following command.
GGSCI> status all or info all

Edit the manager process’s parameters by the following command.

GGSCI> edit params mgr

GGSCI (myserver) 2> edit param mgr


ERROR: Directory /disk1/ogg/12.2c11/dirprm does not exist yet (use CREATE SUBDIRS).

GGSCI (myserver) 8> view param mgr

port 7809
lagreportminutes 5
laginfominutes 1
lagcriticalminutes 2
purgeoldextracts ./dirdat/*, minkeepdays 2, usecheckpoints

GGSCI (myserver) 5> start mgr


Manager started.

GGSCI (myserver) 6> info mgr


Manager is running (IP port myserver.7809, Process ID 5711).

##view report
understand mgr parameter lagreportmin laginfo min lagcriticalmin
b) Configuration of Change Capture using Golden Gate

info trandata scott.*

GGSCI (myserver as gguser@ggsrc) 7> add trandata scott.emp

Logging of supplemental redo data enabled for table SCOTT.EMP.


TRANDATA for scheduling columns has been added on table 'SCOTT.EMP'.
TRANDATA for instantiation CSN has been added on table 'SCOTT.EMP'.

col LOG_GROUP_NAME for a15


SQL> col OWNER for a8
SQL> col TABLE_NAME for a5

SQL> l
1* select * from dba_log_groups where owner='SCOTT'
SQL> /

OWNER LOG_GROUP_NAME TABLE LOG_GROUP_TYPE ALWAYS GENERATED


-------- --------------- ----- ---------------------------- ----------- --------------
SCOTT GGS_87108 EMP USER LOG GROUP ALWAYS USER NAME
SCOTT SYS_C0011089 EMP PRIMARY KEY LOGGING ALWAYS GENERATED NAME
SCOTT SYS_C0011090 EMP UNIQUE KEY LOGGING CONDITIONAL GENERATED NAME
SCOTT SYS_C0011091 EMP FOREIGN KEY LOGGING CONDITIONAL GENERATED NAME

SQL> select object_id from dba_objects where owner='SCOTT' and object_name='EMP';

OBJECT_ID
----------
87108

Extract Directly sending to Replicate

extract ext01
userid gguser@ggsrc,password oracle
discardfile ./dirrpt/ext01.dsc,purge
reportcount every 15 minutes, rate
rmthost myserver, mgrport 7880
rmttrail /disk2/ogg/12.2c11/dirdat/ggsrc/rep01/rt
table scott.emp;

add extract ext01 tranlog , Begin now


add rmttrail /disk2/ogg/12.2c11/dirdat/ggsrc/rep01/rt, extract ext01, megabytes 2

GGSCI (myserver as gguser@dev) 10> info checkpointtable


No checkpoint table specified. Using GLOBALS specification (gguser.chkpt)...

Checkpoint table gguser.chkpt created 2018-10-13 11:53:45.

GGSCI (myserver as gguser@dev) 11> info checkpointtable gguser.chkpt

Checkpoint table gguser.chkpt created 2018-10-13 11:53:45.

replicat REP01
userid gguser@dev,password oracle

DISCARDFILE ./dirout/rep01.dsc, APPEND


map scott.emp,target scott.emp;

add replicat rep01 exttrail /disk2/ogg/12.2c11/dirdat/ggsrc/rep01/rt extseqno 0 extrba 0


checkpointtable gguser.chkpt

Replication using Two Separate Extract Processes for Capture and Data Pump
(Classic)

extract ext1
userid gguser@dev,password oracle
exttrail ./dirdat/ext1/et
table scott.emp;

add extract ext1 tranlog , Begin now


add exttrail ./dirdat/ext1/et extract ext1, megabytes 2

extract pext1
rmthost myserver, mgrport 7880
rmttrail ./dirdat/rep1/rt
table scott.emp;

add extract pext1 exttrailsource ./dirdat/ext1/et


add rmttrail ./dirdat/rep1/rt extract pext1

replicat REP1
userid gguser@dev,password oracle
DISCARDFILE ./dirout/rep1.dsc, APPEND
handlecollisions
map scott.emp,target gg_trc.emp;

add replicat rep1 exttrail ./dirdat/rep1/rt ,nocheckpointtable (or checkpointable <tabname>)

(Integrated)

GGSCI (myserver) 8> !


dblogin userid gguser@ggsrc,password oracle
Successfully logged into database.

GGSCI (myserver as gguser@ggsrc) 9> register extract extint database

2018-11-23 11:47:18 INFO OGG-02003 Extract EXTINT successfully registered with database at
SCN 1084319.

##Check alert log in parallel

ADD EXTRACT extint INTEGRATED TRANLOG, BEGIN NOW


ADD EXTTRAIL ./dirdat/extint/et, EXTRACT extint

EXTRACT extint
userid gguser@ggsrc,password oracle
TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 200, parallelism 2)
EXTTRAIL ./dirdat/extint/et
TABLE src.team;

2018-11-23 11:57:45 ERROR OGG-02912 Patch 17030189 is required on your Oracle mining
database for trail format RELEASE 12.2 or later.
OGG-02912 Patch 17030189 is required on your Oracle mining database for trail format RELEASE
12.2 or later (Doc ID 2304095.1)
[oracle@OGGR2-1 ogg]$ ls -lrt prvtlmpg.plb
-rw-r----- 1 oracle oinstall 9487 May 27 2015 prvtlmpg.plb

Integrated Replicat:
REPLICAT rint
userid gguser@dev,password oracle
DISCARDFILE ./dirout/rint.dsc, APPEND
DBOPTIONS INTEGRATEDPARAMS(parallelism 6)
MAP src.team, TARGET scott.team;

add replicat rint integrated exttrail ./dirdat/EXTINT/r1

SQL> l
1* select * from DBA_GOLDENGATE_INBOUND
REPLICAT_N SERVER_NAM APPLY_US USER_COMME CREATE_DATE STATUS
---------- ---------- -------- ---------- ---------------------------------------- ----------
RINT OGG$RINT GGUSER RINT 07-JAN-19 01.00.52.592663 PM DISABLED

SQL> select APPLY_NAME,QUEUE_NAME,status from dba_apply;

APPLY_NAME QUEUE_NAME STATUS


------------------------------ ------------------------------ ----------
OGG$RINT OGGQ$RINT ENABLED

SQL> select server_id,TOTAL_MESSAGES_APPLIED,apply_name from V$GG_APPLY_SERVER;

SERVER_ID TOTAL_MESSAGES_APPLIED APPLY_NAME


---------- ---------------------- ------------------------------
5 0 OGG$RINT
6 0 OGG$RINT
1 2 OGG$RINT
4 0 OGG$RINT
2 0 OGG$RINT
3 0 OGG$RINT

SQL>
./ggsci
EDIT PARAMS EGGTEST1
EXTRACT EGGTEST1
USERID GGATE_ADMIN@DBORATEST, PASSWORD
AADAAAAAAAAAAAFAQCFIIDLCUELFNFECLITBSCAHYBBHHEUGKDNICDCCDCFELJDJFFEAUHUBFGWIUJ
GCAJJDNDPDZEOHGILBIIWCUIBHHGPBKBHB, AES256, ENCRYPTKEY dbkey1
EXTTRAIL /u01/app/ggate/dirdat/st
TRANSLOGOPTIONS DBLOGREADER
TABLE scott.*;

Initial Load Methods:

Pre-steps:
Supplemental logging required to be enabled
Adding Regular Extract
Performing Initial load
Starting regular Replicate

1. Heterogeneous Environment:
 Here we are using both OGG proprietary Initial load extract and Replicate

extract iext1
userid gguser@ggsrc,password oracle
rmthost myserver, mgrport 7882
rmttask replicat , group irep1
table scott.emp;
ADD EXTRACT iext1, SOURCEISTABLE

replicat irep1
userid gguser@dev,password oracle

DISCARDFILE ./dirout/irep1.dsc, APPEND


map scott.emp,target scott.emp2;

GGSCI (myserver as gguser@dev) 13> add replicat irep1 specialrun


REPLICAT added.

GGSCI (myserver as gguser@dev) 15> info * task

REPLICAT IREP1 Initialized 2018-12-08 21:28 Status STOPPED


Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN

 Here we are using OGG proprietary Initial Load Extract and Classic Replicate

extract iext
userid gguser@ggsrc,password oracle
rmthost myserver, mgrport 7882
rmtfile ./dirdat/iext/i1
table scott.emp

GGSCI (myserver as gguser@ggsrc) 84> add extract iext, sourceistable


EXTRACT added.

GGSCI (myserver as gguser@ggsrc) 87> info all task

Program Status Group Lag at Chkpt Time Since Chkpt

EXTRACT STOPPED IEXT

GGSCI (myserver as gguser@ggsrc) 88> info * task

EXTRACT IEXT Initialized 2018-12-08 21:03 Status STOPPED


Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE

GGSCI (myserver as gguser@ggsrc) 96> !


info iext
EXTRACT IEXT Last Started 2018-12-08 21:13 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Table SCOTT.EMP
2018-12-08 21:13:30 Record 28
Task SOURCEISTABLE

replicat irep
userid gguser@dev,password oracle

DISCARDFILE ./dirout/irep.dsc, APPEND


map scott.emp,target scott.emp2;

add replicat irep exttrail ./dirdat/iext/i1 checkpointtable gguser.chkpt

1. Homogeneous Environment:
Export parfile:
userid='/ as sysdba'
DIRECTORY=DIR
dumpfile=SCOTT_EMP.dmp
logfile=exp_SCOTT_EMP.log
content=data_only
flashback_scn=1305005
tables=scott.emp

import parfile:
userid='/ as sysdba'
DIRECTORY=DIR
dumpfile=SCOTT_EMP.dmp
logfile=imp_SCOTT_EMP.log
remap_table=emp:emp2
tables=scott.emp

2. Adding a table in existing Extract/replicate setup

GGSCI (myserver) 9> info EXT06

EXTRACT EXT06 Last Started 2018-12-10 22:35 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
Process ID 9361
Log Read Checkpoint Oracle Redo Logs
2018-12-13 20:27:09 Seqno 23, RBA 31113216
SCN 0.1327410 (1327410)
Stop the extract and add the new table you want to add

Defgen :
required prior to 12.2

./defgen paramfile dirprm/Extract_defgen.prm

DEFSFILE ./dirdef/Defgen_File.def,PURGE
userid gguser@ggsrc,password oracle
table scott.emp;
table scott.emp3;
table scott.emp4;

./defgen paramfile dirprm/EXT03_defgen_DEV.prm

In replicate end:
Sourcedefs ./dirdef/Defgen_File.def

### to split table in extract

GGSCI (myserver) 33> view param EXT03

extract ext03
userid gguser@ggsrc,password oracle
discardfile ./dirrpt/ext03.dsc,purge
exttrail ./dirdat/ext03/e1
table scott.emp;
table scott.emp3;
table scott.emp4;

GGSCI (myserver) 42> view param ext03a

extract ext03a
userid gguser@ggsrc,password oracle
discardfile ./dirrpt/ext03a.dsc,purge
exttrail ./dirdat/ext03a/e1
table scott.emp3;
table scott.emp4;

GGSCI (myserver) 43> sh mkdir -p ./dirdat/ext03a


GGSCI (myserver) 46> dblogin userid gguser@ggsrc,password oracle
Successfully logged into database.

GGSCI (myserver as gguser@ggsrc) 47> register extract ext03a database

2019-02-20 20:29:35 INFO OGG-02003 Extract EXT03A successfully


registered with database at SCN 1611548.

GGSCI (myserver as gguser@ggsrc) 48> add extract ext03a integrated tranlog


begin now
EXTRACT (Integrated) added.

GGSCI (myserver as gguser@ggsrc) 49> add exttrail ./dirdat/ext03a/e1 extract


ext03a
EXTTRAIL added.

GGSCI (myserver as gguser@ggsrc) 67> add extract pext03a exttrailsource


./dirdat/ext03a/e1
EXTRACT added.

GGSCI (myserver as gguser@ggsrc) 68> add rmttrail ./dirdat/rep03/ra extract


pext03a
RMTTRAIL added.

GGSCI (myserver) 35> send EXT03 logend

Sending LOGEND request to EXTRACT EXT03 ...


YES.

GGSCI (myserver) 36> stop EXT03

Sending STOP request to EXTRACT EXT03 ...


Request processed.

GGSCI (myserver) 37> info pext03

EXTRACT PEXT03 Last Started 2019-02-20 20:04 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
Process ID 29757
Log Read Checkpoint File ./dirdat/ext03/e1000000007
2019-02-20 20:17:04.000000 RBA 4188

GGSCI (myserver) 38> send pext03 logend

Sending LOGEND request to EXTRACT PEXT03 ...


YES.

GGSCI (myserver) 39> stop pext03

Sending STOP request to EXTRACT PEXT03 ...


Request processed.

GGSCI (myserver) 56> stop rep03a

Sending STOP request to REPLICAT REP03A ...


Request processed.

GGSCI (myserver) 57> stop rep03

Sending STOP request to REPLICAT REP03 ...


Request processed.

Recovery Checkpoint (position of oldest unprocessed transaction in the data


source):
Thread #: 1
Sequence #: 57
RBA: 19651088
Timestamp: 2019-02-20 20:43:26.000000
SCN: 0.1633408 (1633408)
Redo File: /disk1/ggsrc/log/redo03.log
GGSCI (myserver as gguser@ggsrc) 71> alter extract EXT03A begin 2019-02-20
20:43:00
EXTRACT altered.
GGSCI (myserver as gguser@ggsrc) 72> info EXT03A

EXTRACT EXT03A Initialized 2019-02-20 21:06 Status STOPPED


Checkpoint Lag 00:23:17 (updated 00:00:10 ago)
Log Read Checkpoint Oracle Integrated Redo Logs
2019-02-20 20:43:00
SCN 0.0 (0)

GGSCI (myserver as gguser@ggsrc) 73> start EXT03A

Sending START request to MANAGER ...


EXTRACT EXT03A starting

GGSCI (myserver as gguser@ggsrc) 74> info EXT03A

EXTRACT EXT03A Initialized 2019-02-20 21:06 Status STARTING


Checkpoint Lag 00:23:17 (updated 00:00:21 ago)
Process ID 31124
Log Read Checkpoint Oracle Integrated Redo Logs
2019-02-20 20:43:00
SCN 0.0 (0)

GGSCI (myserver as gguser@ggsrc) 81> start ext03

Sending START request to MANAGER ...


EXTRACT EXT03 starting

GGSCI (myserver as gguser@dev) 66> delete replicat rep03a


Deleted REPLICAT REP03A.

GGSCI (myserver as gguser@dev) 67> add replicat rep03a exttrail


./dirdat/rep03/ra checkpointtable gguser.chkpt
REPLICAT added.

Manager parameters

port 7811
autostart ER*
autorestart ER * , retries 12, waitminutes 5, resetminutes 60
purgeoldextracts ./dirdat/*/*, usecheckpoints, minkeepfiles 10, frequencyminutes 15
purgeoldextracts ./dirdat/*/*/*, USECHECKPOINTS, MINKEEPFILES 10, FREQUENCYMINUTES
15

LAGCRITICALMINUTES 61
LAGREPORTMINUTES 60
LAGINFOMINUTES 0

You might also like