Tuesday, November 17, 2015

Step by Step GoldenGate 12.1.2.1.0 configuration at Oracle Linux 5.9

Step by Step GoldenGate  12.1.2.1.0 configuration at Oracle Linux 5.9

Oracle GoldenGate is a comprehensive software package for real-time data integration and replication in heterogeneous IT environments. The product set enables high availability solutions, real-time data integration, transactional change data capture, data replication, transformations, and verification between operational and analytical enterprise systems. 

This is a detail document about Oracle GoldenGate configuration at Oracle Linux

Source Server IP            -              192.168.56.103
Database name               -              ORCL (11.2.0.3.0)
Golden Gate Version     -              12.1.2.1.0
Source Schema              -              Scott     
Replication Schema       -              ogg_user
Operating System          -              Oracle Linux 5.9

Target Server IP            -              192.168.56.104
Database name              -              ORCL (11.2.0.3.0)
Golden Gate Version    -              12.1.2.1.0
Source Schema             -              Scott     
Replication Schema      -              ogg_user
Operating System         -              Oracle Linux 5.9

Prepare database for GoldenGate prerequisites
1.                   Turn off Recycle bin feature
2.                   Enable Supplemental log
3.                   Enable database archive log mode
4.                   Create GoldenGate admin user
5.                   Set Undoretention

Login at sqlplus as sys user and  perform above mentioned steps
Turn off recyclebin
SQL> alter system set recyclebin=off scope=spfile;
System altered.

Add Supplemental log
alter database add supplemental log data scope=spfile;
System altered.

Enable Database archivelog mode & supplemental log
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.
Total System Global Area  9999999 bytes
Fixed Size                  999999 bytes
Variable Size             9999999 bytes
Database Buffers          999999999 bytes
Redo Buffers                9999999 bytes
SQL> alter database archivelog;
Database altered.

Enable UNDO RETENTION
SQL> show parameter undo
NAME                                 TYPE        VALUE
———————————— ———– ——————————
undo_management                   string      AUTO
undo_retention                         integer     900
undo_tablespace                       string      UNDOTBS1

SQL> alter system set UNDO_RETENTION=86400 scope=both;
System altered.

Create GoldenGater user & tablespace
create tablespace ogg_data  datafile ‘/u01/<DBNAME>ogg_data01.dbf’ size 300m;
tablespace created

SQL> create user ogg_user identified by oracle default tablespace ogg_user temporary tablespace temp;
User created.

Assign required privileges to ogg_user
SQL> grant connect, resource to ogg_user;
grant select any dictionary, select any table to ogg_user;
grant create table to ogg_user;
grant flashback any table to ogg_user;
grant execute on dbms_flashback to ogg_user;
grant execute on utl_file to ogg_user;
grant create any table to ogg_user;
grant insert any table to ogg_user;
grant update any table to ogg_user;
grant delete any table to ogg_user;
grant drop any table to ogg_user;
grant drop any table to ogg_user;



Initial Load
a       
      At Source Database Server
expdp parfile=expdp_additional_tables.par

Where expdp_additional_tables.par is a parameter file, its contents are

flashback_scn=2117284
DUMPFILE=ogg_user.dmp
LOGFILE=ogg_user.log
TABLES= SCOTT.DEPT,SCOTT.EMP
DIRECTORY=DB_DIR

Here flashback_scn is a specific scn to make a consistent database backup, it can be find by following query

SQL> Select current_scn from v$database;
CURRENT_SCN
-----------
    2117284

Transfer the backup from source to target DB server using below command

scp ogg_user.dmp 192.168.56.104:/home/oracle/

      At Target Database Server
impdp directory=db_dir dumpfile=ogg_user.dmp logfile=ogg_user.log

Configure Source :-
  Add Trandata
i.      Create trandata statement and execute it on gg prompt
SQL> select ‘add trandata ‘||owner||’.’||object_name||’;’ from dba_objects where owner=’SCOTT’ and object_type=’TABLE’;
‘ADDTRANDATA’||OWNER||’.’||OBJECT_NAME||’;’
——————————————————————————–
add trandata SCOTT.EMP;
add trandata SCOTT.DEPT;
Note: Syntax for reference add trandata <owner>.<tablename>
Ø  Configure Manager
Go to goldengate installation location and Invoke ggsci utility
1.       cd /home/oracle/app/oracle/product/11.2.0/oggcore_1/
2.       ./ggsci
3.       DBLOGIN USERID ogg_user, PASSWORD ogg_user
4.       edit params mgr
5.       edit params .. command will open manager configuration file in vi editor, add following lines     
PORT 7809
userid ogg_user, password ogg_user

Ø  Configure Base Extract Process
1.       cd /home/oracle/app/oracle/product/11.2.0/oggcore_1/
2.       ./ggsci
3.       DBLOGIN USERID ogg_user, PASSWORD ogg_user
4.       edit params ext1.prm
5.       add following lines at ext1.prm configuration file
extract ext1
SETENV (ORACLE_HOME="/home/oracle/app/oracle/product/11.2.0/dbhome_1")
SETENV (NLS_DATE_FORMAT="YYYY-MM-DD:HH24:MI:SS")
SETENV (GG_HOME="/home/oracle/app/oracle/product/11.2.0/oggcore_1")
SETENV (ORACLE_GG_HOME="/home/oracle/app/oracle/product/11.2.0/oggcore_1")

6.       userid ogg_user, password ogg_user
7.       exttrail /home/oracle/app/oracle/product/11.2.0/oggcore_1/dirdat/lt
8.       table SCOTT.EMP;
9.       table SCOTT.DEPT;

Ø  Configure Pump Process
1.       cd /home/oracle/app/oracle/product/11.2.0/oggcore_1/
2.       ./ggsci
3.       DBLOGIN USERID ogg_user, PASSWORD ogg_user
4.       edit params pump1.prm
5.       add following lines at pump1.prm configuration file
EXTRACT pump1
SETENV (ORACLE_HOME="/home/oracle/app/oracle/product/11.2.0/dbhome_1")
SETENV (NLS_DATE_FORMAT="YYYY-MM-DD:HH24:MI:SS")
SETENV (GG_HOME="/home/oracle/app/oracle/product/11.2.0/oggcore_1")
SETENV (ORACLE_GG_HOME="/home/oracle/app/oracle/product/11.2.0/oggcore_1")
userid ogg_user, password ogg_user
rmthost ggdbb2, mgrport 7809
rmttrail /home/oracle/app/oracle/product/11.2.0/oggcore_1/dirdat/lt
PASSTHRU
TABLE SCOTT.DEPT;
TABLE SCOTT.EMP;



Configure Target :-
Ø  Configure Manager
Go to goldengate installation location and Invoke ggsci utility
6.       cd /home/oracle/app/oracle/product/11.2.0/oggcore_1/
7.       ./ggsci
8.       DBLOGIN USERID ogg_user, PASSWORD ogg_user
9.       edit params mgr
10.   edit params .. command will open manager configuration file in vi editor, add following lines     
PORT 7809
userid ogg_user, password ogg_user


Configure Replication Process
1.       cd /home/oracle/app/oracle/product/11.2.0/oggcore_1/
2.       ./ggsci
3.       DBLOGIN USERID ogg_user, PASSWORD ogg_user
4.       edit params rep1.prm
5.       add following lines at rep1.prm configuration file
replicat rep1
                SETENV (ORACLE_HOME="/home/oracle/app/oracle/product/11.2.0/dbhome_1")
SETENV (NLS_DATE_FORMAT="YYYY-MM-DD:HH24:MI:SS")
SETENV (GG_HOME="/home/oracle/app/oracle/product/11.2.0/oggcore_1")
                userid ogg_user, password oracle
                ASSUMETARGETDEFS
                MAP SCOTT.EMP, TARGET SCOTT.EMP, COLMAP (USEDEFAULTS) ;
                MAP SCOTT.DEPT, TARGET SCOTT.DEPT, COLMAP (USEDEFAULTS) ;


START EXTRACT AT SOURCE DB :- Invoke ggsci utility and execute following statements
START MGR
START EXTRACT ext1
START EXTRACT pump1

START REPLICAT AT TARGET DB:- Invoke ggsci utility and execute following statements
START MGR
START replicat REP1


No comments:

Post a Comment