Oracle GoldenGate for Oracle 11g to PostgreSQL 9.2.4 Configuration(四)

2014-11-24 17:01:07 · 作者: · 浏览: 7
6 Database character set identified as UTF-8. Locale: en_US.
2013-09-04 13:56:35 INFO OGG-03037 Session character set identified as UTF-8.
Successfully logged into database.
GGSCI (ggpgt) 2> list tables *
public.ggtest
public.t
Found 2 tables matching list criteria.
GGSCI (ggpgt) 3> capture tabledef "public"."ggtest"
Table definitions for public.ggtest:
col1 NUMBER (10) NOT NULL PK
col2 VARCHAR (20)
GoldenGate extract process
In the following section we create an extract process that captures the changes for the GGTEST table in the Oracle database and copies the changes directly to the Postgres machine
Every process needs it config file, so let's create it for the extract process
GGSCI (ggos) 1> edit param epos
with these parameters
GGSCI (ggos) 3> view param epos
EXTRACT epos
SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
SETENV (ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1")
SETENV (ORACLE_SID="oraprod")
USERID zwc, PASSWORD zwc
RMTHOST ggpgt, MGRPORT 7809
RMTTRAIL /data/pgsql/ggs/dirdat/ep
TABLE zwc.ggtest;
My extract process is called epos and it connects as user ZWC using the password zwc to the Oracle database. It will extract changes on the Oracle table ggtest stored in the postgres schema and will put the information into a trail file on my Postgres machine.
Once we created the parameter file we can add the extract process and start it
GGSCI (ggos) 4> add extract epos, tranlog, begin now
EXTRACT added.
GGSCI (ggos) 5> add exttrail /data/pgsql/ggs/dirdat/ep, extract epos, megabytes 5
EXTTRAIL added.
GGSCI (ggos) 6> start epos
Sending START request to MANAGER ...
EXTRACT EPOS starting
GGSCI (ggos) 7> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EPOS 00:00:00 00:00:00
GGSCI (ggos) 12> info extract epos
EXTRACT EPOS Last Started 2013-09-04 22:07 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint Oracle Redo Logs
2013-09-04 22:07:58 Seqno 7, RBA 18612736
SCN 0.1040942 (1040942)
Create DEFINITIONS File
We're replicating data in a heterogeneous environment, so we need to give the process loading the data into the Postgres database more details about the data in the extract file. This is done by creating a definitions file using defgen. As usual we have to create a parameter file
GGSCI (ggos) 17> view param defgen
DEFSFILE /u01/app/oracle/ggs/dirdef/GGTEST.def
USERID zwc, password zwc
TABLE ZWC.GGTEST;
Now exit from ggsci and call defgen on the command line and add the reference to the defgen parameter file just created
[oracle@ggos ggs]$ ./defgen paramfile ./dirprm/defgen.prm
***********************************************************************
Oracle GoldenGate Table Definition Generator for Oracle
Version 11.2.1.0.7 16934304 OGGCORE_11.2.1.0.7_PLATFORMS_130709.1600.1
Linux, x64, 64bit (optimized), Oracle 11g on Jul 18 201