1.配置window,添加checkpoint表(本文windows和linux互为source和target) GGSCI (WIN-GM5PVS1CILH) 1> view param ./GLOBALS ggschema ggs checkpointtable ggs.chkpt GGSCI (WIN-GM5PVS1CILH) 2> dblogin userid ggs,password ggs Successfully logged into database. GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 3> add checkpointtable No checkpoint table specified. Using GLOBALS specification (ggs.chkpt)... Successfully created checkpoint table ggs.chkpt. GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 4> #在mgr的参数文件中添加 ipadd ACCESSRULE, PROG *, IPADDR 192.168.0.*, ALLOW 2.配置linux,运行相关的脚本,支持DDL的复制 [oracle@Oracle02 admin]$ cd /u01/app/oracle/product/ogg_src/ [oracle@Oracle02 ogg_src]$ sqlplus /nolog SQL> conn /as sysdba Connected. SQL> GGSCI (Oracle02 as ggt@orcl) 31> view param ./GLOBALS ggshcame gtt checkpointtable ggt.chkpt GGSCI (Oracle02 as ggt@orcl) 32> SQL> conn /as sysdba Connected. SQL> @marker_setup.sql SQL> @ddl_setup.sql # GoldenGate 12c 不用关闭recyclebin SQL> @role_setup.sql SQL> grant ggs_ggsuser_role to ggt; SQL> @ddl_enable.sql SQL> @?/rdbms/admin/dbmspool.sql SQL> @ddl_pin.sql ggt 3. linux上配置extract和pump进程 3.1 配置 extract GGSCI (Oracle02 as ggt@orcl) 4> view param eora_t2 extract eora_t2 setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK) ddl include all userid ggt,password ggt tranlogoptions excludeuser ggt #避免出现死循环复制,window上的extract进程也需要进行此项设置 exttrail dirdat/sp table scott.*; GGSCI (Oracle02 as ggt@orcl) 6> add extract eora_t2,tranlog,begin now EXTRACT added. GGSCI (Oracle02 as ggt@orcl) 7> add exttrail dirdat/sp,extract eora_t2,megabytes 100 EXTTRAIL added. GGSCI (Oracle02 as ggt@orcl) 8> start extract eora_t2 GGSCI (Oracle02 as ggt@orcl) 24> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING EORA_T2 00:10:26 00:00:10 REPLICAT RUNNING RORA_T1 00:00:00 02:42:29 GGSCI (Oracle02 as ggt@orcl) 25> 3.2 配置 pump GGSCI (Oracle02 as ggt@orcl) 25> view params pora_t2 extract pora_t2 setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK) passthru rmthost 192.168.0.100,mgrport 7809 rmttrail dirdat/rp table scott.*; GGSCI (Oracle02 as ggt@orcl) 26> add extract pora_t2,exttrailsource dirdat/sp EXTRACT added. GGSCI (Oracle02 as ggt@orcl) 27> add rmttrail dirdat/rp extract pora_t2,megabytes 100 RMTTRAIL added. GGSCI (Oracle02 as ggt@orcl) 28> start extract pora_t2 Sending START request to MANAGER ... EXTRACT PORA_T2 starting GGSCI (Oracle02 as ggt@orcl) 31> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING EORA_T2 00:00:00 00:00:00 EXTRACT RUNNING PORA_T2 00:00:00 00:00:05 REPLICAT RUNNING RORA_T1 00:00:00 00:00:02 GGSCI (Oracle02 as ggt@orcl) 32> 4.wind上配置replicat进程 GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 18> edit param rora_t2 GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 19> view param rora_t2 replicat rora_t2 setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK) ddl include all #ddl相关操作不要忘记添加 ddlerror default ignore retryop maxretries 3 retrydelay 5 userid ggs,password ggs handlecollisions assumetargetdefs discardfile dirrpt/rora_t2.dsc,purge map scott.* ,target scott.*; GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 20> add replicat rora_t2,exttrail dirdat/rp REPLICAT added. GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 21> start replicat rora_t2 Sending START request to MANAGER ('GGSMGR') ... REPLICAT RORA_T2 starting GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 22> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING EORA_T1 00:00:02 00:00:00 EXTRACT RUNNING PORA_T1 00:00:00 00:00:01 REPLICAT RUNNING RORA_T2 00:00:00 00:00:02 GGSCI (WIN-GM5PVS1CILH as ggs@orcl) 23>5.测试 5.1在linux平台创建表 插入数据 [oracle@Oracle02 ogg_src]$ sqlplus /nolog SQL> conn scott/scott Connected. SQL> create table t5 (id number primary key,name varchar2(20)); Table created. SQL> insert into t5 values (1,'one'); 1 row created. SQL> commit; Commit complete. SQL> 5.2 在wind平台验证 C:\ora11g\product\ogg_src>sqlplus /nolog SQL> conn /as sysdba 已连接。 SQL> conn scott/scott 已连接。 SQL> select * from t5; ID NAME ---------- -------------------- 1 one SQL>