ogg12c測試oracle11.2.0.4同步
本次實驗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.