That’s Me

Gavin Soorma
  • Oracle Certified Professional
  • 7.3, 8i, 9i,10g, 11g
  • 11i Apps DBA OCP
  • 10g RAC OCE
  • Certified GoldenGate Implementation Specialist
  • 10g OCM
  • 11g OCM

  • Feedback

    1,650,000 hits

    Thanks A MILLION for your support!

    Please send me your valuable feedback and suggestions






    Oracle GoldenGate Tutorial 5 – configuring online change synchronization

    In our earlier tutorial, we examined how to create a GoldenGate environment for initial data capture and load.

    In this tutorial, we will see how by using GoldenGate change synchronization, changes that occur on the source (Oracle 11g on Linux) are applied near real time on the target (Oracle 11g on AIX). The table on the source is the EMP table in SCOTT schema which is being replicated to the EMP table in the target database SH schema.

    These are the steps that we will take:

    Create a GoldenGate Checkpoint table
    Create an Extract group
    Create a parameter file for the online Extract group
    Create a Trail
    Create a Replicat group
    Create a parameter file for the online Replicat group

    Create the GoldenGate Checkpoint table

    GoldenGate maintains its own Checkpoints which is a known position in the trail file from where the Replicat process will start processing after any kind of error or shutdown. This ensures data integrity and a record of these checkpoints is either maintained in files stored on disk or table in the database which is the preferred option.

    We can also create a single Checkpoint table which can used by all Replicat groups from the single or many GoldenGate instances.

    In one of the earlier tutorials we had created the GLOBALS file. We now need to edit that GLOBALS file and add an entry for CHECKPOINTTABLE which will include the checkpoint table name which will be available to all Replicat processes via the EDIT PARAMS command.

    GGSCI (devu007) 2> EDIT PARAMS ./GLOBALS

    GGSCHEMA GGS_OWNER
    CHECKPOINTTABLE GGS_OWNER.CHKPTAB

    GGSCI (devu007) 4> DBLOGIN USERID ggs_owner, PASSWORD ggs_owner
    Successfully logged into database.

    GGSCI (devu007) 6> ADD CHECKPOINTTABLE GGS_OWNER.CHKPTAB

    Successfully created checkpoint table GGS_OWNER.CHKPTAB.

    apex:/u01/oracle/software/goldengate> sqlplus ggs_owner/ggs_owner
    
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon Feb 8 09:02:19 2010
    
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> desc chkptab
    
    Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     GROUP_NAME                                NOT NULL VARCHAR2(8)
     GROUP_KEY                                 NOT NULL NUMBER(19)
     SEQNO                                              NUMBER(10)
     RBA                                       NOT NULL NUMBER(19)
     AUDIT_TS                                           VARCHAR2(29)
     CREATE_TS                                 NOT NULL DATE
     LAST_UPDATE_TS                            NOT NULL DATE
     CURRENT_DIR                               NOT NULL VARCHAR2(255)
    

    Create the Online Extract Group

    GGSCI (redhat346.localdomain) 1> ADD EXTRACT ext1, TRANLOG, BEGIN NOW
    EXTRACT added.

    Create the Trail

    We now create a trail – note that this path pertains to the GoldenGate software location on the target system and this is where the trail files will be created having a prefix ‘rt’ which will be used by the Replicat process also running on the target system

    GGSCI (redhat346.localdomain) 2> ADD RMTTRAIL /u01/oracle/software/goldengate/dirdat/rt, EXTRACT ext1
    RMTTRAIL added.

    Create a parameter file for the online Extract group ext1

    GGSCI (redhat346.localdomain) 3> EDIT PARAMS ext1

    EXTRACT ext1
    USERID ggs_owner, PASSWORD ggs_owner
    RMTHOST devu007, MGRPORT 7809
    RMTTRAIL /u01/oracle/software/goldengate/dirdat/rt
    TABLE scott.emp;

    ON TARGET SYSTEM

    Create the online Replicat group

    GGSCI (devu007) 7> ADD REPLICAT rep1, EXTTRAIL /u01/oracle/software/goldengate/dirdat/rt
    REPLICAT added.

    Note that the EXTTRAIL location which is on the target local system conforms to the RMTTRAIL parameter which we used when we created the parameter file for the extract process on the source system.

    Create a parameter file for the online Replicat group, rep1

    GGSCI (devu007) 8> EDIT PARAMS rep1

    REPLICAT rep1
    ASSUMETARGETDEFS
    USERID ggs_owner, PASSWORD ggs_owner
    MAP scott.emp, TARGET sh.emp;

    ON SOURCE

    Start the Extract process

    GGSCI (redhat346.localdomain) 16> START EXTRACT ext1

    Sending START request to MANAGER …
    EXTRACT EXT1 starting

    GGSCI (redhat346.localdomain) 17> STATUS EXTRACT ext1
    EXTRACT EXT1: RUNNING

    GGSCI (redhat346.localdomain) 16> INFO EXTRACT ext1

    EXTRACT EXT1 Last Started 2010-02-08 14:27 Status RUNNING
    Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
    Log Read Checkpoint Oracle Redo Logs
    2010-02-08 14:27:48 Seqno 145, RBA 724480

    ON TARGET

    Start the Replicat process

    GGSCI (devu007) 1> START REPLICAT rep1
    Sending START request to MANAGER …
    REPLICAT REP1 starting

    GGSCI (devu007) 2> INFO REPLICAT rep1

    REPLICAT REP1 Last Started 2010-02-08 14:55 Status RUNNING
    Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
    Log Read Checkpoint File /u01/oracle/software/goldengate/dirdat/rt000001
    2010-02-08 14:27:57.600425 RBA 1045

    Note: the trail file has a prefix of ‘rt’ (which we had defined earlier)

    LET US NOW TEST …

    ON SOURCE

    SQL> conn scott/tiger
    Connected.

    SQL> UPDATE emp SET sal=9999 WHERE ename=’KING’;

    1 row updated.

    SQL> COMMIT;

    Commit complete.

    ON TARGET

    SQL> SELECT SAL FROM emp WHERE ename=’KING’;

    SAL
    ———-
    9999

    Coming Next! – configuring GoldenGate Data Pump …..

    12 comments to Oracle GoldenGate Tutorial 5 – configuring online change synchronization

    • Shabbir

      Can we extract from physical standy, to avoid load on primary server?

    • Kamal

      Hi Gavin,

      When i start a replicat process for online synchronisation it abends with the following error

      GGS ERROR 101 Oracle GoldenGate Delivery for Oracle, EMP_REP.prm: Invalid option for MAP: .

      I am trying to synchronize two tables(with same structure) of same database(Oracle) but different schemas.

      Some you please solve this for me.

      Thanks,

      Kamal

    • Kamal

      Hi,

      Solved the problem.

      The error was due to a space missing between the comma (,) and TARGET (keyword) in the Replicat params file.

      eg: my params had MAP sourcetable,TARGET targettable;
      instead of MAP sourcetable, TARGET targettable;

      Thanks,
      Kamal

    • Hi Philip – I think what you can do is that you can create a materialized view based on the records you want from the source table 1 and table 2 and use this MV to push records to table 3 in the target database – GGate allows column transformations and column mapping, but I think the mapping is from one source table to one target table – not sure if you can do mapping where you say I want column a and b from table 1 and column c and d from table 2 to become 4 columns in target table 3 ….

    • Manju

      Hi gavin ,
      i was trying to install Goldengate 10.4 on IBM AIX 5.3 powerssytem after tar ing the files when i try to run ggsci i get below errors
      Could not load program ggsci:
      Symbol resolution failed for ggsci because:
      Symbol _GetCatName__FiPCc (number 159) is not exported from dependent
      module /usr/lib/libC.a[ansi_64.o].
      Symbol __ct__Q2_3std8_LocinfoFPCci (number 184) is not exported from dependent
      module /usr/lib/libC.a[ansi_64.o].
      Examine .loader section symbols with the ‘dump -Tv’ command.

      please let me know solutions if you have come across this kind of problem

    • Before launching ggsci, check your environment – LD_LIBRARY_PATH and LIBPATH – it should point to $ORACLE_HOME/lib

    • Raghu

      Hi Gavin,

      Your explanation are really good.

      I have a small confusion that we can implement the Golden Gate other than Oracle Databases. Then how can it recognize the transactions of someother db.

      I have read that trail file will be i UDF(Universal Data Fomat). How this really works.

      If possible can u please post the sample trail file

      Thanks in advance for ur suggestions

      Raghu

    • Hi Raghu – the Golden Gate extract process writes to a trail file which is stored on the OS file system in proprietory format which can be read only by Goldengate – the trail file is the same as far as Golden Gate is concerned whether the source database is 9i or 10g or 11g or even some other RDBMS like DB2 or Sybase. The same trail file is then read by the GoldenGate replicat process and it does not matter to it what was the source database from where the trail file came from – it just reads the trail file. I am not sure what your doubt is – but Goldengate is available for most main RDBMS types other than just Oracle

    • Antony

      Gavin..i was working on this tool for 5-6 years..in various capacities as tech support/consulting etc etc…after reading the tutorials …i can say you did an excellant job…and you have a great heart to share the knowledge and help others …i salute that spirit
      -Antony

    • GG

      Hi,

      Is there any way to specify timewise asynchronize replication.
      Like 15 mins/hour replication?

      Thanks

    • Terry Alexander

      Gavin, Your a star. Your examples are very good. I have been trying to follow the examples in a book I bought. There have been a few problems with the examples in the book. But your’s are spot on thanks Gavin.
      Cheers,
      Terry

    • neerudba

      Hi

      I have a Primary environment which is a 2 node rac environment and secondary environment which is a single node environment
      I have successfully tested replication of SCHEMA from Production environment to Secondary environment

      However the following scenario is where i would request your expert advise and guidance
      if we have to do any testing , we shut down the primary server , then perform the testing on the seconary server ( which is in sync due to the goldengate replication )
      after we have verified that the testing is successfully we know want to replicate this back on the primary environment

      Under this circumstance the one option is that after the testing is complete , copy the secndary database to prmary server nd recreate the rac enviroment and release to the users
      however doing this is very time consuming for us in our environment

      under this scenario is there an easier option in which we can configure goldengate to sync up the changes from secondary back to primary after the testing is complete

      Thanks a lot , looking forward to your comments

    Leave a Reply

     

     

     

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>