Experimental environment:
SOURCE End:
ip:192.168.40.10
Database:oracle 11.2.0.1.0 ORCL
os:oel5.6
Ogg:fbo_ggs_linux_x86_ora11g_32bit
Target side:
ip:192.168.40.128
database:10.2.0.1.0 ORCL
os:oel5.6
Ogg:fbo_ggs_linux_x86_ora11g_32bit
First configure the environment variables on two machines, adding the following and making them effective:
Export ggate= $ORACLE _base/ogg
Export ld_library_path= $ORACLE _home/lib:/lib:/usr/lib: $GGATE
And all the paths are established:
mkdir $ORACLE _base/ogg
Source-side configuration:
[Oracle@badly9 ~]$ Sqlplus/as SYSDBA
Sql*plus:release 11.2.0.1.0 Production on Sat June 7 17:23:51 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition release 11.2.0.1.0-production
With the partitioning, OLAP, Data Mining and real application testing options
Sys@orcl>archive Log List
Database Log Mode Archive mode
Automatic Archival Enabled
Archive Destination Use_db_recovery_file_dest
Oldest online log sequence 5
Next Log sequence to archive 7
Current Log Sequence 7
Sys@orcl>select supplemental_log_data_min from V$database;
Suppleme
--------
NO
Sys@orcl>alter database add supplemental log data;
Database altered.
Sys@orcl>select supplemental_log_data_min from V$database;
Suppleme
--------
YES
Sys@orcl>alter database force logging;
Database altered.
Sys@orcl>create tablespace Tbs_ogg
2 datafile '/u01/app/oracle/oradata/orcl/datafile/tbs_ogg01.dbf ' size 200M
3 autoextend on;
Tablespace created.
Sys@orcl>create user ogg identified by ogg default Tablespace tbs_ogg;
User created.
Sys@orcl>grant CONNECT,RESOURCE,DBA to Ogg;
Grant succeeded.
Sys@orcl>grant execute on Utl_file to Ogg;
Grant succeeded.
Sys@orcl>grant Select any dictionary,select any table to Ogg;
Grant succeeded.
Sys@orcl>grant alter any table to OGG;
Grant succeeded.
Sys@orcl>grant Flashback any table to Ogg;
Grant succeeded.
Sys@orcl>grant execute on Dbms_flashback to Ogg;
Grant succeeded.
Target side:
Sys@orcl>create tablespace Tbs_ogg
2 datafile '/u01/app/oracle/oradata/orcl/tbs_ogg01.dbf ' size 200M
3 autoextend on;
Tablespace created.
Sys@orcl>create user ogg identified by ogg default Tablespace tbs_ogg;
User created.
Sys@orcl>grant CONNECT,RESOURCE,DBA to Ogg;
Grant succeeded.
Sys@orcl>grant execute on Utl_file to Ogg;
Grant succeeded.
Sys@orcl>grant Insert any table to OGG;
Grant succeeded.
Sys@orcl>grant Delete any table to Ogg;
Grant succeeded.
Sys@orcl>grant Update any table to Ogg;
Grant succeeded.
Source End and Target end
[Oracle@badly9 ~]$ TAR-XVF Fbo_ggs_linux_x86_ora11g_32bit.tar
userexitexamples/
userexitexamples/exitdemo_passthru/
Userexitexamples/exitdemo_passthru/makefile_passthru. Aix
。。。 Slightly...
[Oracle@badly9 ~]$./ggsci
SOURCE End:
Ggsci (badly9) 1> Create Subdirs
Creating subdirectories under current Directory/u01/app/oracle/ogg
Parameter Files/u01/app/oracle/ogg/dirprm:already exists
files/u01/app/oracle/ogg/dirrpt:created
Checkpoint files/u01/app/oracle/ogg/dirchk:created
Process Status files/u01/app/oracle/ogg/dirpcs:created
SQL Script files/u01/app/oracle/ogg/dirsql:created
Database Definitions files/u01/app/oracle/ogg/dirdef:created
Extract Data files/u01/app/oracle/ogg/dirdat:created
Temporary files/u01/app/oracle/ogg/dirtmp:created
Stdout files/u01/app/oracle/ogg/dirout:created
Ggsci (badly9) 2> edit params Mgr
Ggsci (badly9) 3> view params Mgr
Port 7809
Dynamicportlist 7800-8000
AutoRestart Extract *,waitminutes 2,resetminutes 5
Ggsci (badly9) 4> start Mgr
Manager started.
Ggsci (badly9) 5> edit params Eora
Ggsci (badly9) 6> view params Eora
Extract Eora
Dynamicresolution
UserID Ogg,password ogg
Exttrail/u01/app/oracle/ogg/dirdat/et
Table scott.*;
Ggsci (BADLY9) 7>dblogin userid ogg, password ogg
Successfully logged into database.
Ggsci (badly9) 8>add trandata scott.*
Ggsci (badly9) 9> Add extract Eora,tranlog,begin now
EXTRACT added.
Ggsci (badly9) 10> add exttrail/u01/app/oracle/ogg/dirdat/et,extract Eora
Exttrail added.
Ggsci (Badly9) 11> start extract Eora
Sending START request to MANAGER ...
EXTRACT EORA Starting
Ggsci (badly9) 12> edit params Pump_so
Ggsci (badly9) 13> view params pump_so
Extract Pump_so
Dynamicresolution
PassThru
Rmthost 192.168.40.128,mgrport 7809,compress
Rmttrail/u01/app/oracle/ogg/dirdat/pt
Table scott.*;
Ggsci (badly9) 14> Add extract Pump_so,exttrailsource/u01/app/oracle/ogg/dirdat/et
EXTRACT added.
Ggsci (badly9) 15> add rmttrail/u01/app/oracle/ogg/dirdat/pt,extract pump_so
Rmttrail added.
Ggsci (badly9) 16> info All
Program Status Group Lag at chkpt time Since chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA 00:00:00 00:00:02
EXTRACT RUNNING pump_so 00:00:00 00:00:07
To configure a target-side process:
Because the target side is using Oracle 10g, the error is when starting Ggsci:
[Oracle@jp ogg]$ Ggsci
Ggsci:error while loading shared libraries:libnnz11.so:cannot open Shared object file:no such file or directory
Add Soft Links:
Ln-s/u01/app/oracle/product/10.2.0/db_1/lib/libnnz10.so libnnz11.so
Start the error again:
[Oracle@jp ogg]$ Ggsci
Ggsci:error while loading shared libraries:libclntsh.so.11.1:cannot open Shared object file:no such file or directory
Add one more Soft link:
Ln-s/u01/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1 libclntsh.so.11.1
Start normal again:
[Oracle@jp ogg]$ Ggsci
Oracle Goldengate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 11g on APR 23 2012 08:09:25
Copyright (C) 1995, the Oracle and/or its affiliates. All rights reserved.
Ggsci (JP) 1> Create Subdirs
Creating subdirectories under current Directory/u01/app/oracle/ogg
Parameter Files/u01/app/oracle/ogg/dirprm:already exists
files/u01/app/oracle/ogg/dirrpt:created
Checkpoint files/u01/app/oracle/ogg/dirchk:created
Process Status files/u01/app/oracle/ogg/dirpcs:created
SQL Script files/u01/app/oracle/ogg/dirsql:created
Database Definitions files/u01/app/oracle/ogg/dirdef:created
Extract Data files/u01/app/oracle/ogg/dirdat:created
Temporary files/u01/app/oracle/ogg/dirtmp:created
Stdout files/u01/app/oracle/ogg/dirout:created
Ggsci (JP) 2> edit params Mgr
Ggsci (JP) 3> view params Mgr
Port 7809
Dynamicportlist 7800-8000
Autostart ER *
AutoRestart Extract *,waitminutes 2,retries 5
Lagreporthours 1
Laginfominutes 3
Lagcriticalminutes 5
Purgeoldextracts/u01/app/oracle/ogg/dirdat/rt*,usecheckpoints,minkeepdays 3
Ggsci (JP) 4> start Mgr
Manager started.
Ggsci (JP) 5> info All
Program Status Group Lag at chkpt time Since chkpt
MANAGER RUNNING
Ggsci (JP) 12> edit params Rep2
Ggsci (JP) 13> view params Rep2
Replicat REP2
UserID Ogg,password ogg
Assumetargetdefs
Reperror Default,discard
Discardfile./dirrpt/rep1.dsc,append,megabytes 50
Dynamicresolution
--map Ogg.test,target ogg.test;
Map scott.*, Target scott.*;
Ggsci (JP) 9> dblogin userid Ogg,password ogg;
Successfully logged into database.
Ggsci (JP) 14> add checkpointtable ogg.checkpoint
Successfully created Checkpoint table Ogg.checkpoint.
Ggsci (JP) 16> add Replicat rep2,exttrail/u01/app/oracle/ogg/dirdat/pt,checkpointtable ogg.checkpoint
Replicat added.
Ggsci (JP) 17> start REP2
Sending START request to MANAGER ...
Replicat REP2 Starting
Ggsci (JP) 18> info All
Program Status Group Lag at chkpt time Since chkpt
MANAGER RUNNING
Replicat RUNNING REP2 00:00:00 00:00:00
DML test
SOURCE End:
Scott@orcl>insert into dept values (A, ' TEST ', ' TEST1 ');
1 row created.
scott@orcl>commit;
Commit complete.
Target side:
Scott@orcl>select * FROM Dept;
DEPTNO dname LOC
---------- -------------- -------------
Ten ACCOUNTING NEW YORK
DALLAS
SALES CHICAGO
OPERATIONS BOSTON
TEST1 TEST
The test was successful.
Note: Scott user and the corresponding table already exist in both the source and target side of the experiment, so there is no data initialization process.