OGG单向复制(支持DDL复制)
1 源端执行
[oracle@oggs11.2.0]$ ./ggsci
Oracle GoldenGate Command Interpreter forOracle
Version 11.2.1.0.1OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11gon Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or itsaffiliates. All rights reserved.
GGSCI(oggs) 1> edit param ./GLOBALS
ggschema ggs
[oracle@oggs11.2.0]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0Production on Wed Feb 24 17:21:34 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL>conn /as sysdba;
Connected.
SQL>@marker_setup.sql
Marker setup script
You will be prompted for the name of aschema for the Oracle GoldenGate database objects.
NOTE: The schema must be created prior torunning this script.
NOTE: Stop all DDL replication beforestarting this installation.
Enter Oracle GoldenGate schema name:ggs
Marker setup table script complete, runningverification script...
Please enter the name of a schema for theGoldenGate database objects:
Setting schema name to GGS
MARKER TABLE
-------------------------------
OK
MARKER SEQUENCE
-------------------------------
OK
Script complete.
SQL>show parameter recyclebin;
NAME TYPE VALUE
------------------------------------ -----------------------------------------
recyclebin string on
SQL>alter system set recyclebin=off;
alter system set recyclebin=off
*
ERROR at line 1:
ORA-02096: specified initialization parameteris not modifiable with this
option
SQL>alter system set recyclebin=off DEFERRED;
System altered.
SQL>@ddl_setup.sql
Oracle GoldenGate DDL Replication setupscript
Verifying that current user has privilegesto install DDL Replication...
You will be prompted for the name of aschema for the Oracle GoldenGate database objects.
NOTE: For an Oracle 10g source, the systemrecycle bin must be disabled. For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior torunning this script.
NOTE: Stop all DDL replication beforestarting this installation.
EnterOracle GoldenGate schema name:ggs --此处输入需要DLL的用户名
SUCCESSFUL installation of DDL Replicationsoftware components
Script complete.
SQL>@role_setup.sql
GGS Role setup script
This script will drop and recreate the roleGGS_GGSUSER_ROLE
To use a different role name, quit thisscript and then edit the params.sql script to change the gg_role parameter tothe preferred name. (Do not run the script.)
You will be prompted for the name of aschema for the GoldenGate database objects.
NOTE: The schema must be created prior torunning this script.
NOTE: Stop all DDL replication beforestarting this installation.
EnterGoldenGate schema name:ggs
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned tothe Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO<loggedUser>
where <loggedUser> is the userassigned to the GoldenGate processes.
SQL>GRANT GGS_GGSUSER_ROLE TO ggs;
Grant succeeded.
SQL>@ddl_enable.sql
Trigger altered.
SQL>@?/rdbms/admin/dbmspool.sql
Package created.
Grant succeeded.
SQL>@ddl_pin.sql ggs
[oracle@oggs11.2.0]$ ./ggsci
Oracle GoldenGate Command Interpreter forOracle
Version 11.2.1.0.1OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11gon Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or itsaffiliates. All rights reserved.
GGSCI(oggs) 1> edit params ext1
extract ext1
dynamicresolution
userid ggs,password ggs
setenv(ORACLE_SID=oggs)
ddl include all
exttrail /u01/ggs/11.2.0/dirdat/et
table ggs.test_pri, COLSEXCEPT(NAME2,NAME3);
table ggs.test;
GGSCI(oggs) 2> stop extract ext1
Sending STOP request to EXTRACT EXT1 ...
Request processed.
GGSCI(oggs) 3> start ext1
Sending START request to MANAGER ...
EXTRACT EXT1 starting
GGSCI(oggs) 4> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:04
EXTRACT RUNNING PUMP1 00:00:00 00:00:07
2 目标端执行
[oracle@oggt11.2.0]$ ./ggsci
Oracle GoldenGate Command Interpreter forOracle
Version 11.2.1.0.1OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11gon Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or itsaffiliates. All rights reserved.
GGSCI(oggt) 2> edit params repl
replicat repl
userid ggs,password ggs
assumetargetdefs
reperror default,discard
discardfile /u01/ggs/11.2.0/dirrpt/repl.dsc,append,megabytes50
dynamicresolution
sourcedefs /u01/ggs/test_pri.p
ddl include all
ddlerror default ignore retryop maxretries 3 retrydelay 5
map ggs.test_pri,target ggs.test_pri;
map ggs.test,target ggs.test;
GGSCI(oggt) 3> stop repl
Sending STOP request to REPLICAT REPL ...
Request processed.
GGSCI(oggt) 4> start repl
Sending START request to MANAGER ...
REPLICAT REPL starting
GGSCI(oggt) 5> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REPL 00:00:00 00:00:05
注:文档中红色为需要添加的内容