本次实验oracle数据库为11.2.0.4
gg版本为:
Oracle GoldenGate Command Interpreter for Oracle
Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140727.2135.1_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 7 2014 09:14:25
1.源端安装
12c的gg采用oui图形界面运行runInstaller安装如下:
在源端数据库内授权:
create user ggs identified by ggs;
grant connect,resource,unlimited tablespace to ggs;
grant execute on utl_file to ggs;
grant select any dictionary,select any table to ggs;
grant alter any table to ggs;
grant flashback any table to ggs;
SQL> alter database add supplemental log data;
Database altered.
SQL> alter database force logging;
GGSCI (bre1) 11> dblogin userid ggs,password ggs
Successfully logged into database.
2.目标端安装:
目标端和源端一样使用oui界面安装
在数据库创建用户并授权:
create user ggt identified by ggt;
grant dba to ggt;
创建checkpointtable,在ogg home创建GLOBALS文件:
[oracle@bre2 oracle]$ cat GLOBALS
checkpointtable ggt.chkpt
GGSCI (bre2) 2> dblogin userid ggt,password ggt
Successfully logged into database.
GGSCI (bre2 as ggt@bre2) 3>
GGSCI (bre2 as ggt@bre2) 3>
GGSCI (bre2 as ggt@bre2) 3> add checkpointtable
No checkpoint table specified. Using GLOBALS specification (ggt.chkpt)...
Successfully created checkpoint table ggt.chkpt.
3.配置源端程序
一、配置extract进程:
GGSCI (bre1) 54> edit params ext_t1
Extract ext_t1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid [email protected]/bre1,password ggs
exttrail dirdat/sp
table test.CJ_CW_CWSJ;
GGSCI (bre1) 18>
add extract ext_t1,tranlog,begin now
EXTRACT added.
GGSCI (bre1) 20>
add exttrail dirdat/sp,extract ext_t1,megabytes 100
EXTTRAIL added.
GGSCI (bre1) 21> start extract ext_t1
Sending START request to MANAGER ...
EXTRACT EXT_T1 starting
GGSCI (bre1) 22> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_T1 00:00:00 00:02:03
由于是11.2.0.4版本,需要在数据库内设置参数:
ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE SCOPE=BOTH;
GGSCI (bre1) 28> start extract ext_t1
Sending START request to MANAGER ...
EXTRACT EXT_T1 starting
GGSCI (bre1) 29> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_T1 00:07:16 00:00:01
二、配置datapump进程:
GGSCI (bre1) 55> edit params dp_t1
extract dp_t1
passthru
rmthost 192.168.56.46 ,mgrport 7008
rmttrail dirdat/rp
table test.Cj_Cw_Cwsj;
GGSCI (bre1) 50>
add extract dp_t1,exttrailsource dirdat/sp
EXTRACT added.
GGSCI (bre1) 51>
add rmttrail dirdat/rp,extract dp_t1,megabytes 100
RMTTRAIL added.
GGSCI (bre1) 52> start ext dp_t1
Sending START request to MANAGER ...
EXTRACT DP_T1 starting
GGSCI (bre1) 53> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DP_T1 00:00:00 00:01:39
EXTRACT RUNNING EXT_T1 00:00:00 00:00:04
4.配置目标端程序
配置replicat进程:
GGSCI (bre2) 29> edit params rep_t1
replicat rep_t1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggt,password ggt
handlecollisions
assumetargetdefs
map test.*,target test.*;
GGSCI (bre2) 7>
add replicat rep_t1,exttrail dirdat/rp
REPLICAT added.