A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Wednesday, December 31, 2014

New Year, Career and Success

Do you hope to get your career on track in 2015?

I can’t answer what your definition of success and happiness should be. Only you can do that. I can, however, give you insight into a sobering way to keep yourself on track for accomplishing whatever it is you’d like to achieve—for the rest of your life.
2015 is almost upon us and the buzz of the New Year is already in the air. It is around this time of year, we begin to think about the goals that we have accomplished and the plans still in the making.
Each year, we reflect on the years passed and then consider the year ahead. We've done so much in our lives, had so many experiences, both personally and professionally we often arrive at a point of: What's next for me?
With each year, we can count on change. With each year, we can count on new experiences. With each year, we can count on continuing our quest for the pursuit of happiness and fulfillment.
It is the pursuit of happiness and fulfillment that drives us to enhance the quality of our lives, year after year. Four core areas, in particular, are at the forefront of the pursuit of happiness and fulfillment: career, social Relationships, companionship and leisure.
Let's think for a moment here about how these core areas really affect us.
Career: Are you really happy with your career track?
Have you lost track of your long-term career goals in the everyday running around? If you have been thinking of starting your own business, or switching careers to pursue your ideal position, there is no better time than now to do so. Take the opportunity of a new year to make new beginnings and to get yourself back on track professionally.

Let this coming year be better than all the others.

In the coming year may you find,
happiness, use your abilities to solve problems and challenges;
hope
, may you always have it, never lose this;
goals, to keep you focus on your dreams; and,
 
success, by solving your problems, focusing on your goals, and always having hope, good fortune will find you

Friday, December 12, 2014

Oracle GoldenGate Data Integration Replication Test

Oracle GoldenGate Create Extract, Repilicat and Pump Testing Case

The previous post was about  Step by Step Installing and Configuring Oracle 11gR2 GoldenGate So, In this article i would like to present the basic replication of Oracle GoldenGate. 


SOURCEISTABLE Designates Extract as an initial load process extracting records directly from the source tables.
 SPECIALRUN Implements the initial-load Replicat as a one-time run that does not use checkpoints.
  1. Create the Extract Groups (AT SOURCE)

    GGSCI (excellentJob1) 1> ADD EXTRACT ext2, SOURCEISTABLE
     EXTRACT added. 
     
     GGSCI (excellentJob1) 2> ADD EXTTRAIL /u01/ogg1/dirdat/lt, EXTRACT ext2
     EXTTRAIL added. 

    GGSCI (excellentJob1) 3> EDIT PARAMS ext2
     
    -- SET the parameters extract
     
     EXTRACT ext2
    userid ogg, password oracle
    rmthost 192.17.242.188, mgrport 7809
    rmttrail /u01/app/ogg2/dirdat/lt
    DDL INCLUDE ALL;
    TRANLOGOPTIONS DBLOGREADER
    ddl include mapped objname WINSURE.*;
    table ECHO.*;
    table ECHO.APPLVLLOG;
    table ECHO.VEYSI;
    table ECHO.DETAIL;
    :wq!
     
     
    GGSCI (excellentJob1) 4> ADD EXTRACT pump1, EXTTRAILSOURCE /u01/ogg1/dirdat/lt
    EXTRACT added.
     
    GGSCI (excellentJob1) 5> EDIT PARAMS pump1
     
    -- set parameter pump1
      EXTRACT PUMP1
    USERID OGG, PASSWORD oracle
    SETENV (ORACLE_SID = "ORCL")
    SETENV (NLS_LANG = "AMERICAN_AMERICA.WE8ISO8859P9")
    STATOPTIONS, RESETREPORTSTATS, REPORTFETCH
    REPORTCOUNT EVERY 2 MINUTES, RATE
    DISCARDFILE /u01/ogg1/dirrpt/PUMP1.dsc, APPEND, MEGABYTES 200
    RMTHOST 192.17.242.188, MGRPORT 7809, COMPRESS
    RMTTRAIL /u01/app/ogg2/dirdat/1t, FORMAT LEVEL 2
    PASSTHRU
    TABLE WINSURE.*;
    :wq!
    
    
    
    
  2. Create the Replicat Group (AT TARGET)

      GGSCI (excellentJob2) 1> EDIT PARAMS ./GLOBAL

    -- Set Parameter Global 

     GGSCHEMA OGG
    CHECKPOINTTABLE OGG.checkpoint


      GGSCI (excellentJob2) 2> dblogin userid ogg password oracle
     Successfully logged into database.
     
    GGSCI (excellentJob2) 3> add checkpointtable ogg.checkpoint
     Successfully created checkpoint table ogg.CHECKPOINT.

    GGSCI (excellentJob2) 4> ADD REPLICAT rep2, SPECIALRUN

    GGSCI (excellentJob2) 5> EDIT PARAMS  rep2 

    REPLICAT rep2
    ASSUMETARGETDEFS
    HANDLECOLLISIONS
    APPLYNOOPUPDATES
    userid ogg, password oracle
    DDL INCLUDE ALL
    DISCARDFILE /u01/app/ogg2/discards, PURGE
    --SOURCEDEFS /u01/ogg1/dirdef/defgen1.sql
    DDLERROR DEFAULT IGNORE RETRYOP

    MAP ECHO.*,                         TARGET ECHO.*;
    MAP ECHO.APPLVLLOG,       TARGET ECHO.APPLVLLOG;
    MAP ECHO.VEYSI,               TARGET ECHO.VEYSI;
    MAP ECHO.DETAIL,           TARGET ECHO.DETAIL;

     :wq!

    Now get SCN from database for initial 

     SQL> SELECT to_char (dbms_flashback.get_system_change_number) from dual; 
    TO_CHAR(DBMS_FLASHBACK.GET_SYSTEM_CHANGE
    ----------------------------------------
    1343190

    EXPORT SOURCE
    [oracle@excellentJob1 ]$ expdp directory=test_dir dumpfile=ECHO.dmp logfile=ECHO.log schemas=ECHO flashback_scn=1343190

    [oracle@excellentJob1 ]$ scp –p ECHO.dmp 192.17.242.188:/u01/pump

     IMPORT TARGET 

    [oracle@excellentJob2 ]$ impdp directory=test_dir dumpfile=ECHO.dmp logfile=ECHO1.log schemas=ECHO REMAP_TABLESPACE=old:new
    


    [oracle@excellentJob1 ogg1]$ ggsci
     
    GGSCI (excellentJob1) 1> start ext2
     Sending START request to MANAGER …
    EXTRACT EXT2 starting 
     
    GGSCI (excellentJob1) 2> start pump1
     Sending START request to MANAGER ...
    EXTRACT PUMP1 starting
     
      
    GGSCI (excellentJob1) 3> info all
     Program     Status      Group       Lag at Chkpt  Time Since Chkpt
    
    MANAGER     RUNNING
    EXTRACT     RUNNING     EXT2        00:00:00      00:00:11
    EXTRACT     RUNNING     PUMP1       00:00:00      00:00:07
     
     
    [oracle@excellentJob2 ogg2]$ ggsci,
     
    GGSCI (excellentJob2) 1> start replicat rep2
      Sending START request to MANAGER …
    REPLICAT REP2 starting 

    GGSCI (excellentJob2) 2> info all 

    Program          Status           Group       Lag at Chkpt    Time Since Chkpt
     

    MANAGER  RUNNING
    REPLICAT    RUNNING     REP2        00:00:00           00:00:08


    Now Lest create new table at source database.

    --SOURCE--

    [oracle@excellentJob1 ]$ sqlplus / as sysdba
     
    SQL> create table ECHO.gold(
    
    ID                 VARCHAR2(5 BYTE) ,
    First_Name         VARCHAR2(20 BYTE),
    Last_Name          VARCHAR2(20 BYTE),
    Salary             Number(8,2),
    City               VARCHAR2(10 BYTE),
    );
     
    Table created. 
    
    
    SQL> Insert into ECHO.gold values(
    1, ‘no1’);
    SQL> Insert into ECHO.gold values(
    2,’no2’);
    SQL> Insert into ECHO.gold values(
    3,’no3’);
    SQL> Insert into ECHO.gold values(
    4,’Uno4’);
    SQL> Insert into ECHO.gold values(
    5,’no5’);
    SQL> commit;
     
     SQL> select count(*) from ECHO.gold;
     
      COUNT(*)
    ----------
            5
     
     [oracle@excellentJob1 ogg1]$ggsci
      
    GGSCI (excellentJob1) 1> stop *
     
    GGSCI (excellentJob1) 1>EDIT PARAMS ext2
     
    -- SET the parameters extract
     
     EXTRACT ext2
    userid ogg, password oracle
    rmthost 192.17.242.188, mgrport 7809
    rmttrail /u01/app/ogg2/dirdat/lt
    DDL INCLUDE ALL;
    TRANLOGOPTIONS DBLOGREADER
    ddl include mapped objname WINSURE.*;
    table ECHO.*;
    table ECHO.APPLVLLOG;
    table ECHO.VEYSI;
    table ECHO.DETAIL;
    table ECHO.GOLD;
     :wq!
     
    --TARGET--
     
    GGSCI (excellentJob2) 1> STOP *

    GGSCI (excellentJob2) 2> EDIT PARAMS  rep2 

    REPLICAT rep2
    ASSUMETARGETDEFS
    HANDLECOLLISIONS
    APPLYNOOPUPDATES
    userid ogg, password oracle
    DDL INCLUDE ALL
    DISCARDFILE /u01/app/ogg2/discards, PURGE
    --SOURCEDEFS /u01/ogg1/dirdef/defgen1.sql
    DDLERROR DEFAULT IGNORE RETRYOP

    MAP ECHO.*,                       TARGET ECHO.*;
    MAP ECHO.APPLVLLOG,       TARGET ECHO.APPLVLLOG;
    MAP ECHO.VEYSI,                TARGET ECHO.VEYSI;
    MAP ECHO.DETAIL,              TARGET ECHO.DETAIL;

    MAP ECHO.gold,                   TARGET ECHO.gold;
     :wq!

    --SOURCE--
    [oracle@excellentJob1 ogg1]$ ggsci
     
    GGSCI (excellentJob1) 1> start ext2
     Sending START request to MANAGER …
    EXTRACT EXT2 starting 
     
    GGSCI (excellentJob1) 2> start pump1
     Sending START request to MANAGER ...
    EXTRACT PUMP1 starting
     
      
    GGSCI (excellentJob1) 3> info all
     Program     Status      Group       Lag at Chkpt  Time Since Chkpt
    
    MANAGER     RUNNING
    EXTRACT     RUNNING     EXT2        00:00:00      00:02:09
    EXTRACT     RUNNING     PUMP1       00:00:00      00:02:07
     
     --TARGET--
     
    GGSCI (excellentJob2) 1> start replicat rep2
      Sending START request to MANAGER …
    REPLICAT REP2 starting 

    GGSCI (excellentJob2) 2> info all 

    Program          Status           Group       Lag at Chkpt    Time Since Chkpt
     

    MANAGER  RUNNING
    REPLICAT    RUNNING     REP2        00:00:00           00:01:02
     
    [oracle@excellentJob2 ]$ SQLPLUS / AS SYSDBA
      SQL> select count(*) from ECHO.gold;   
    ----------
            5
     
     

Sunday, December 7, 2014

Installing and Configuring Oracle GoldenGate for Oracle Database


Step by Step  Installing and Configuring

Oracle 11gR2 GoldenGate 


 In this article I'd like to  illustrate the installation of Oracle GoldenGate on an Oracle Enterprise Linux 6.5. What we know about Oracle DB replication by using Golden Gate ?
This first post is about installing GG software and creating the simplest replication using only the “extract” and “replicat” processes.
GG can support a number of different business requirements like:
·  Business Continuity and High Availability
·  Data migrations and upgrades
·  Decision Support Systems and Data Warehousing
·  Data integration and consolidation
Oracle GoldenGate provides very fast replication of heterogeneous databases by reading transaction logs and writing the changes to one or more target databases. There are five processes involved in a typical environment:
Manager:
Starts and stops the other processes on both the source and target hosts. Not required once Extract or Replicate is running.
Initial Load:
Optional. Used to populate the target tables one time. It can read either from the source tables directly or from ASCII files. This OBE will not use an Initial Load.
Extract:
Runs on the source to capture transaction data to trail files. There are two versions of Extract: Classic (this OBE) and Integrated.
Data Pump:
Optional, but highly recommended. Sends trail files from the source to the target over an IP network. Technically it is a secondary Extract.
Replicate:
Delivers data to the target database. Normally the Replicate runs on the target.

Downloading Oracle GoldenGate
·  Navigate to http://edelivery.oracle.com.
The Oracle Software Delivery Cloud page appears.
·  Click Sign-in/Register.
·  Accept the Oracle Software Delivery Cloud Trial License Agreement and the Export Restrictions and click Continue.
The Media Pack Search page appears.
·  On the Media Pack Search page, do the following:
  1. Click the Select Product Pack drop-down control and, from the list, select Oracle Fusion Middleware.
  2. Click the Platform drop-down control and, from the list, select the platform on which you are installing Oracle GoldenGate.
  3. Click Go.
Now Let’s start installing Oracle GG.
1.       Set bash for path by using vi command (for both database)
# Oracle bash_profile Environment Settings
 
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
 
ORACLE_HOSTNAME=excellentJob1; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
DB_HOME=$ORACLE_BASE/product/11.2.0.3/db; export DB_HOME
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_HOME_LISTNER=$ORACLE_HOME export ORACLE_HOME_LISTNER
GG_HOME=/u01/ogg1; export GG_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
PATH=$ORACLE_HOME/bin:$GG_HOME:$ORACLE_HOME/OPatch:$PATH:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/lib:$GG_HOME; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
 
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi


2.       So, Run the following command to accept bash profile(for both database)
[oracle@excellentJob1 ]$  export PATH=$PATH:/u01/ogg
[oracle@excellentJob1 ]$  export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/ogg

3.       We have to create directories for both servers.
[oracle@excellentJob1 ]$  mkdir /u01/ogg1/

4.      [oracle@excellentJob1 ]$ cd /u01/ogg1
5.       [oracle@excellentJob1 ogg1]$ unzip V34339-01.zip  
                      Archive:  V34339-01.zip
                      inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar  
                      inflating: Oracle_GoldenGate_11.2.1.0.3_README.doc  
                      inflating: Oracle GoldenGate_11.2.1.0.3_README.txt  
                      inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.3.pdf 
 
6.      [oracle@excellentJob1 ogg1]$ tar -xvpf fbo_ggs_Linux_x64_ora11g_64bit.tar 
                    UserExitExamples/
                    UserExitExamples/ExitDemo_more_recs/
                    UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX
 
                     ... many lines 
 
                    ulg.sql
                    usrdecs.h
                    zlib.txt
7.        [oracle@excellentJob1 ogg1]$ ./ggsci
 
GGSCI (excellentJob1) 1> CREATE SUBDIRS
Creating subdirectories under current directory /u01/ogg1
 
Parameter files                /u01/ogg1/dirprm: created
Report files                   /u01/ogg1/dirrpt: created
Checkpoint files               /u01/ogg1/dirchk: created
Process status files           /u01/ogg1/dirpcs: created
SQL script files               /u01/ogg1/dirsql: created
Database definitions files     /u01/ogg1/dirdef: created
Extract data files             /u01/ogg1/dirdat: created
Temporary files                /u01/ogg1/dirtmp: created
Stdout files                   /u01/ogg1/dirout: created
 
GGSCI (excellentJob1) 1> exit
 
[oracle@excellentJob1 ogg1]$
 
Do the same steps for the other host. Unpack the software in its directory on host2.
Create the installation directory to receive the Oracle GoldenGate software.
[oracle@excellentJob2]$ cd /u01/app/oracle 
[oracle@excellentJob2 oracle]$ mkdir ogg2 
[oracle@excellentJob2  ogg2]$ unzip V34339-01.zip  
                      Archive:  V34339-01.zip
                      inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar  
                      inflating: Oracle_GoldenGate_11.2.1.0.3_README.doc  
                      inflating: Oracle GoldenGate_11.2.1.0.3_README.txt  
                      inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.3.pdf 
 
[oracle@excellentJob2 ]$ tar -xvpf fbo_ggs_Linux_x64_ora11g_64bit.tar 
                    UserExitExamples/
                    UserExitExamples/ExitDemo_more_recs/
                    UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX
 
                     ... many lines 
 
                    ulg.sql
                    usrdecs.h
                    zlib.txt
[oracle@excellentJob2 ]$ cd /u01/app/oracle/ogg2
1.      [oracle@excellentJob2 ogg2]$ ./ggsci
 
GGSCI (excellentJob2) 1> CREATE SUBDIRS
Creating subdirectories under current directory /u01/app/oracle/ogg2
 
Parameter files                /u01/app/oracle/ogg2/dirprm: created
Report files                   /u01/app/oracle/ogg2/dirrpt: created
Checkpoint files               /u01/app/oracle/ogg2/dirchk: created
Process status files           /u01/app/oracle/ogg2/dirpcs: created
SQL script files               /u01/app/oracle/ogg2/dirsql: created
Database definitions files     /u01/app/oracle/ogg2/dirdef: created
Extract data files             /u01/app/oracle/ogg2/dirdat: created
Temporary files                /u01/app/oracle/ogg2/dirtmp: created
Stdout files                   /u01/app/oracle/ogg2/dirout: created
 
GGSCI (excellentJob2) 1> exit

.1 Configuring the Oracle 11gR2 Databases (for both database)

This section must be done in SQL*Plus as sysdba.
The database should be on archive log mode
[oracle@excellentJob1 ogg1]$ sqlplus / as sysdba   (for both database)
SQL> SELECT log_mode FROM v$database; 
 
LOG_MODE
------------
ARCHIVELOG
 
Verify that supplemental logging and forced logging are set properly. (for both database)
SQL> alter system set recyclebin=off scope=spfile; (make sure that recycle is off)
 
SQL> SELECT force_logging, supplemental_log_data_min FROM v$database;
 
FOR SUPPLEME
--- --------
NO  NO
 
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 
Database altered.
 
SQL> ALTER DATABASE FORCE LOGGING; 
Database altered.
 
SQL> ALTER SYSTEM SWITCH LOGFILE; 
System altered.
 
SQL> SELECT force_logging, supplemental_log_data_min FROM v$database;
 
FOR SUPPLEME
--- --------
YES YES
 
Create Tablespace and the administrator, user/schema owners. (for first database)
SQL> create tablespace goldengate datafile size 500m autoextend on next 10m maxsize unlimited;
 
Tablespace created.
 
 
SQL> CREATE USER sender IDENTIFIED BY veysi1 default tablespace goldengate;
User created.
 
SQL> CREATE USER oggadm1 IDENTIFIED BY veysi1; 
User created.
 
SQL> GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO sender; 
Grant succeeded. 
 
SQL> GRANT dba TO oggadm1; 
Grant succeeded. 
 
SQL> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE (grantee=>'OGGADM1',privile
ge_type=>'capture',grant_select_privileges=>true, do_grants=>TRUE); 
PL/SQL procedure successfully completed.
 
SQL> exit 
 
Create the administrator and user/schema owners. (for second database)
 
SQL> CREATE USER receiver IDENTIFIED BY veysi1 default tablespace goldengate; 
User created.
 
SQL> CREATE USER oggadm2 IDENTIFIED BY veysi1; 
User created.
 
SQL> GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO sender; 
Grant succeeded. 
 
SQL> GRANT dba TO oggadm2; 
Grant succeeded. 
 
SQL> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE (grantee=>'OGGADM2',privile
ge_type=>'capture',grant_select_privileges=>true, do_grants=>TRUE); 
PL/SQL procedure successfully completed.
 
SQL> exit 
 
Now Run scripts for creating all necessary objects for support ddl replication: (for both database)
 
[oracle@excellentJob1 ogg1]$ cd $GG_HOME
[oracle@excellentJob1 ogg1]$ sqlplus / as sysdba 
SQL> @marker_setup.sql;
 
Marker setup script
 
You will be prompted for the name of a schema for the Oracle 
GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
 
Enter Oracle GoldenGate schema name:sender
 
Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GOLDENGATE
 
MARKER TABLE
-------------------------------
OK
 
MARKER SEQUENCE
-------------------------------
OK
 
Script complete.
 
SQL> @ddl_setup.sql;
 
Oracle GoldenGate DDL Replication setup script
 
Verifying that current user has privileges to install DDL Replication...
 
You will be prompted for the name of a schema for the Oracle GoldenGate
database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled.
For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
 
Enter Oracle GoldenGate schema name:sender
 
Working, please wait ...
Spooling to file ddl_setup_spool.txt
 
Checking for sessions that are holding locks on Oracle Golden Gate 
metadata tables ...
 
Check complete.
 
Using GOLDENGATE as a Oracle GoldenGate schema name.
 
Working, please wait ...
 
DDL replication setup script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GOLDENGATE
 
CLEAR_TRACE STATUS:
 
Line/pos   Error
---------- ------------------------
No errors  No errors
 
CREATE_TRACE STATUS:
 
Line/pos   Error
---------- ------------------------
No errors  No errors
 
.
..
...
 
DDL TRIGGER TRACE LEVEL
-----------------------------------
0
 
LOCATION OF DDL TRACE FILE
-----------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/ggs_ddl_trace.log
 
Analyzing installation status...
 
STATUS OF DDL REPLICATION
-----------------------------------
SUCCESSFUL installation of DDL Replication software components
 
Script complete.
 
--
 
SQL> @role_setup.sql;
 
GGS Role setup script
 
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql
script to change the gg_role parameter to the preferred name.
(Do not run the script.)
 
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
 
Enter GoldenGate schema name:sender
Wrote file role_setup_set.txt
 
PL/SQL procedure successfully completed.
 
Role setup script complete
 
Grant this role to each user assigned to the Extract, GGSCI,
and Manager processes, by using the following SQL command:
 
GRANT GGS_GGSUSER_ROLE TO <loggedUser>
 
where <loggedUser> is the user assigned to the GoldenGate processes.
 
-- 
SQL> grant GGS_GGSUSER_ROLE to sender;
Grant succeeded.
 
SQL> @ddl_enable.sql;
Trigger altered.
 

Creating Startup Files and Managers (for both database)

Create the GLOBALS file on host1 in the Oracle GoldenGate installation directory using your text editor of choice.
It is possible to create and/or edit the GLOBALS file from inside GGSCI by prepending the name with "./".
[oracle@excellentJob1 ogg1]$ vi GLOBALS
 
CheckpointTable oggadm1.oggchkpt 
 
[oracle@excellentJob1]$ cd $GG_HOME
[oracle@excellentJob1 ogg1]$ ggsci
 
 
GGSCI (excellentJob1) 1> edit param mgr
 
-- Write the port by “vi”
 
PORT 7809
 
 
GGSCI (excellentJob1) 2> start manager
 
Manager started.
 
GGSCI (excellentJob1) 3> info all
 
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
 
MANAGER     RUNNING
 
-- Starting "extract" 
GGSCI (excellentJob1) 4> add extract Ext1, tranlog, begin now
EXTRACT added.
 
-- Adding TRIAL
GGSCI (excellentJob1)) 5> ADD EXTTRAIL /u01/ogg1/dirdat/ex, EXTRACT Ext1
EXTTRAIL added.
 
GGSCI (excellentJob1)  6> ADD RMTTRAIL /u01/ogg1/dirdat/lt, EXTRACT EXT1
RMTTRAIL added.
 
GGSCI (excellentJob1) 7> edit params ext1
 
-- Set Parameter
 
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0.3/db")
SETENV (ORACLE_SID = "orcl")
EXTRACT ext1
USERID sender, PASSWORD veysi1
--EXTTRAIL /u01/ogg1/dirdat/ex
RMTHOST excellentJob1, MGRPORT 7809
ddl include mapped objname source.*;
RMTTRAIL /u01/ogg1/dirdat/lt
TABLE source.*;
 
-- Check the services
 
GGSCI (excellentJob1)  8> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING                                           
EXTRACT     STOPPED     Ext1        00:00:00      00:05:01
 
-- Now start on TARGET
 
[oracle@excellentJob2 ]$  cd $GG_HOME
[oracle@excellentJob2 ogg2]$  ggsci
 
 
GGSCI (excellentJob2)  1> dblogin userid receiver
Password: 
Successfully logged into database.
 
GGSCI (excellentJob2)  2> add checkpointtable receiver.checkpoint
 
Successfully created checkpoint table receiver.checkpoint.
 
GGSCI (excellentJob2)  3> add replicat Repl1, 
exttrail /u01/app/ogg2/dirdat/lt,checkpointtable receiver.checkpoint
REPLICAT added
 
GGSCI (excellentJob2)   4> edit param Repl1
 
--SET PARAMETER 
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0.3/db")
SETENV (ORACLE_SID = "orcl")
REPLICAT Repl1
ASSUMETARGETDEFS
userid receiver, password veysi1
discardfile /u01/app/ogg2/discard/Repl1.txt, append, megabytes 20
DDL
map source.*, target target.*;
 
-- Starting Extract source db
 
GGSCI (excellentJob1)  1> start extract Ext1
Sending START request to MANAGER ...
EXTRACT EXT1 starting
 
GGSCI (excellentJob1)  2> info all
 
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
 
MANAGER     RUNNING                                           
EXTRACT     RUNNING     Ext1        00:00:00      00:00:07
 
On target start Replicat
 
GGSCI (excellentJob2)  1> start replicat Repl1
 
Sending START request to MANAGER ...
REPLICAT REP1 starting
 
GGSCI (excellentJob2)  2> info all
 
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
 
MANAGER     RUNNING                                           
REPLICAT    RUNNING     Repl1        00:00:00      00:00:09
 
Also We can create script and doing the same Replications (other option)
Create the optional startup.oby (Obey) file on host1 in the Oracle GoldenGate installation directory.
These are GGSCI commands that are done almost every time you start GGSCI, and they do not persist between sessions, so you will find yourself entering them many, many times, and therefore it is convenient to create a startup obey file.
[oracle@excellentJob1 ogg1]$ vi startup.oby

DBLogin UserID oggadm1@orcl, Password veysi1
Start Mgr
Info Mgr
Info CheckpointTable 
Set Editor gedit 
Create the Manager parameter (mgr.prm) file on host11 in dirprm/.
Start GGSCI. Edit the file with no extension. Add the two lines (plus comments).
[oracle@excellentJob1 ogg1]$./ggsci 
 
GGSCI (excellentJob2) 1> Edit Param mgr 

Port 7809
PurgeOldExtracts ./dirdat/*, UseCheckpoints 
 
GGSCI (excellentJob2) 1> Info mgr 
Manager is DOWN!
Start the Manager on host1 using the Obey files. Alternatively, you could type each of the lines every time you start GGSCI. (for both database)
GGSCI (excellentJob1) 3> Obey startup.oby 
 
GGSCI (excellentJob1) 5> DBLogin UserID oggadm1@orcl, Password veysi1
Successfully logged into database.
 
GGSCI (excellentJob1)) 6> Start Mgr
Manager started.
 
GGSCI (excellentJob1) 7> Info Mgr
Manager is running .
 
GGSCI (excellentJob1) 8> Info CheckpointTable 
 
No checkpoint table specified, using GLOBALS specification (oggadm1.oggchkpt)...
Checkpoint table oggadm1.oggchkpt does not exist.
 
GGSCI (excellentJob1) 9> Set Editor gedit 
 
GGSCI (excellentJob1) 10>   
 
Create the checkpoint table on both database
 
GGSCI (excellentJob1)) 10>  Add CheckpointTable 
 
No checkpoint table specified, using GLOBALS specification (oggadm1.oggchkpt).
Successfully created checkpoint table oggadm1.oggchkpt.
 
GGSCI (excellentJob1)  11>  Exit  
 
[oracle@excellentJob1 ogg1]$