一概述:
三台主机分别安装数据库ORACLE 9.2.6 升级至9.2.0.8.0,gg1为源端,gg2.gg3 为目标端,
gg1 上配置一个抽取,两个泵取进程,每个泵取进程关联gg2与gg3上的每个复制进程,gg1端要求开启归档,gg2,gg3主机可选是否开启归档
此次测试的三台虚拟机是克隆的一台虚拟机的快照,克隆后调整每台虚拟机的IP地址,注意还要调整数据库的tnsnames.ora及listener.ora文件
的主机名或ip地址,主机名及ip调整参考ip地址规划
1.1 ip 规划:
[oracle@gg1 admin]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.201 gg1.abc.com gg1
192.168.1.202 gg2.abc.com gg2
192.168.1.203 gg3.abc.com gg3
1.2 操作系统版本:
[root@gg1 ~]# uname -rm
2.6.9-78.EL x86_64
[root@gg1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
1.3 数据库版本:
[oracle@gg1 ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.8.0 - Production on Mon May 12 01:26:04 2014
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect /as sysDBA
Connected.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for Linux: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
[oracle@gg1 ggs]$ ggsci -v
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
备注:oracle 9i 数据库的安装及升级参考其他相关文档,此处不做详细说明
1.4 goldengate 软件版本:
压缩包:V28957-01
goldengate v11.1.1.1.2
ggs_Linux_x64_ora9i_64bit.tar
二 goldengate 软件安装
以下操作无特别说明均是在三台虚拟机上做同样的操作
2.1 创建安装用户
此次测试均采用 oracle 用户安装,为创建单独的goldengate软件安装用户
调整oracle 用户的 .bash_profile 文件添加以下内容
调整前:
[oracle@gg1 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATHHOME/bin
#export PATH
# Oracle 9i
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/9.2.0; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/binPATH; export PATH
ORACLE_OWNER=oracle; export ORACLE_OWNER
ORACLE_SID=orcl; export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JREORACLE_HOME/jlibORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATHORACLE_HOME/network/jlib; export CLASSPATH
LD_ASSUME_KERNEL=2.4.19; export LD_ASSUME_KERNEL
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
#unset USERNAME
调整后:
设置环境变量主要为下面两行的调整:
export PATH=$PATHORACLE_HOME/bin:/home/oracle/ggs
export LD_LIBRARY_PATH=/home/oracle/ggsORACLE_HOME/lib
调整后的.bash_profile
[oracle@gg1 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATHHOME/bin
#export PATH
# Oracle 9i
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/9.2.0; export ORACLE_HOME
GGHOME=/home/oracle/ggs;export GGHOME
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/binPATH:/home/oracle/ggs; export PATH
ORACLE_OWNER=oracle; export ORACLE_OWNER
ORACLE_SID=orcl; export ORACLE_SID
LD_LIBRARY_PATH=/home/oracle/ggsORACLE_HOME/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib; export CLASSPATH
LD_ASSUME_KERNEL=2.4.19; export LD_ASSUME_KERNEL
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
#unset USERNAME
2.2 创建goldengate 软件安装目录
[oracle@gg1 ~]$ mkdir ggs
[oracle@gg1 ~]$ pwd
/home/oracle
[oracle@gg1 ~]$ cd ggs
[oracle@gg1 ggs]$ pwd
/home/oracle/ggs
2.3 上传goldengate软件,安装goldengate软件
关闭iptables服务:
[root@gg1 ~]# chkconfig --list | grep iptables
iptables 0ff 1ff 2n 3n 4n 5n 6ff
[root@gg1 ~]# service iptables status
Firewall is stopped.
[root@gg1 ~]# chkconfig iptables off
[root@gg1 ~]# chkconfig --list | grep sendmail
sendmail 0ff 1ff 2ff 3:off 4:off 5:off 6:off
防止相应端口被禁止,熟悉的话也可配置开放相应端口
关闭sendmail服务:
[root@gg1 ~]# service sendmail status
sendmail is stopped
[root@gg1 ~]# chkconfig sendmail off
sendmai 启动时间较长,禁止启动
[root@gg1 ~]# pwd
/root
[root@gg1 ~]# ls -l
total 266848
-rw-r--r-- 1 root root 3061 Sep 25 2012 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Sep 25 2012 Desktop
-rwxrwxrwx 1 root root 272834560 Oct 4 2011 ggs_Linux_x64_ora9i_64bit.tar
-rw-r--r-- 1 root root 72353 Sep 25 2012 install.log
-rw-r--r-- 1 root root 44487 Sep 25 2012 install.log.syslog
[root@gg1 ~]# chmod 777 ggs_Linux_x64_ora9i_64bit.tar
[root@gg1 ~]# mv ggs_Linux_x64_ora9i_64bit.tar /home/oracle/ggs/
[root@gg1 ~]# su - oracle
[oracle@gg1 ~]$ cd /home/oracle/ggs
[oracle@gg1 ggs]$ ls -l
total 266708
-rwxrwxrwx 1 root root 272834560 Oct 4 2011 ggs_Linux_x64_ora9i_64bit.tar
[oracle@gg1 ggs]$ tar xf ggs_Linux_x64_ora9i_64bit.tar
[oracle@gg1 ggs]$ pwd
/home/oracle/ggs
[oracle@gg1 ggs]$ ls -l
total 515316
-r--r--r-- 1 oracle oinstall 426 Oct 15 2010 bcpfmt.tpl
-r--r--r-- 1 oracle oinstall 1725 Oct 15 2010 bcrypt.txt
drwxr-xr-x 2 oracle oinstall 4096 Oct 5 2011 cfg
-r--r--r-- 1 oracle oinstall 739 Oct 15 2010 chkpt_ora_create.sql
-rwxr-xr-x 1 oracle oinstall 8196774 Oct 5 2011 cobgen
-rwxr-xr-x 1 oracle oinstall 8138288 Oct 5 2011 convchk
-r--r--r-- 1 oracle oinstall 159 Oct 15 2010 db2cntl.tpl
-r--r--r-- 1 oracle oinstall 3334 Oct 15 2010 ddl_access.tpl
-r--r--r-- 1 oracle oinstall 1059 Oct 15 2010 ddl_cleartrace.sql
-rwxr-xr-x 1 oracle oinstall 8277118 Oct 5 2011 ddlcob
-r--r--r-- 1 oracle oinstall 3502 Oct 15 2010 ddl_db2_os390.tpl
-r--r--r-- 1 oracle oinstall 3017 Oct 15 2010 ddl_db2.tpl
-r--r--r-- 1 oracle oinstall 4189 Oct 15 2010 ddl_ddl2file.sql
-r--r--r-- 1 oracle oinstall 746 Oct 15 2010 ddl_disable.sql
。。。。。。。输出较多部分省略。。。。。。。。。。。。
2.4 配置mgr(相应的管理进程端口均为7809),创建goldengate相关目录:
[oracle@gg1 ggs]$ cd $GGHOME
[oracle@gg1 ggs]$ pwd
/home/oracle/ggs
[oracle@gg1 ggs]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (gg1.abc.com) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (gg1.abc.com) 2> create subdirs
Creating subdirectories under current directory /home/oracle/ggs
Parameter files /home/oracle/ggs/dirprm: created
Report files /home/oracle/ggs/dirrpt: created
Checkpoint files /home/oracle/ggs/dirchk: created
Process status files /home/oracle/ggs/dirpcs: created
SQL script files /home/oracle/ggs/dirsql: created
Database definitions files /home/oracle/ggs/dirdef: created
Extract data files /home/oracle/ggs/dirdat: created
Temporary files /home/oracle/ggs/dirtmp: created
Veridata files /home/oracle/ggs/dirver: created
Veridata Lock files /home/oracle/ggs/dirver/lock: created
Veridata Out-Of-Sync files /home/oracle/ggs/dirver/oos: created
Veridata Out-Of-Sync XML files /home/oracle/ggs/dirver/oosxml: created
Veridata Parameter files /home/oracle/ggs/dirver/params: created
Veridata Report files /home/oracle/ggs/dirver/report: created
Veridata Status files /home/oracle/ggs/dirver/status: created
Veridata Trace files /home/oracle/ggs/dirver/trace: created
Stdout files /home/oracle/ggs/dirout: created
GGSCI (gg1.abc.com) 3> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (gg1.abc.com) 4> edit params mgr
port 7809
~
"dirprm/mgr.prm" [New] 1L, 10C written
GGSCI (gg1.abc.com) 5> view report mgr
ERROR: REPORT file MGR does not exist.
GGSCI (gg1.abc.com) 6> view params mgr
port 7809
GGSCI (gg1.abc.com) 7> info all
Program Status Group Lag Time Since Chkpt
MANAGER STOPPED
GGSCI (gg1.abc.com) 8> start mgr
Manager started.
GGSCI (gg1.abc.com) 9> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
确认gg1,gg2,gg3三台虚拟机上状态均同上
---2.1至2.4操作均在三台虚拟机上操作
2.5 源端(gg1)及目标端(gg2,gg3)数据库参数调整
源端配置
.oracle数据库设置
SQL> create user ggs identified by ggs account unlock;
SQL> grant dba to ggs
【如果对权限有要求,如没要求,一般就给dba权限,详细权限为:
SQL> GRANT create table to ggs;
SQL> GRANT CONNECT TO ggs;
SQL> GRANT ALTER ANY TABLE TO ggs;
SQL> GRANT ALTER SESSION TO ggs;
SQL> GRANT CREATE SESSION TO ggs;
SQL> GRANT FLASHBACK ANY TABLE TO ggs;
SQL> GRANT SELECT ANY DICTIONARY TO ggs;
SQL> GRANT SELECT ANY TABLE TO ggs;
SQL> GRANT RESOURCE” TO ggs;
SQL> GRANT DELETE ANY TABLE TO ggs;
SQL> GRANT INSERT ANY TABLE TO ggs;
SQL> GRANT UPDATE ANY TABLE TO ggs;
SQL> GRANT RESTRICTED SESSION TO ggs; 】
将数据库设置为归档模式:
SQL> alter database archivelog(在mount 状态下执行)
修改归档模式参数
SQL> archive log list(查看归档状态)
检查源端数据库的附加日志是否打开:
SQL> select supplemental_log_data_min from v$database;
将附加日志打开:
SQL> alter database add supplemental log data;
切换日志使附加日志生效:
SQL> alter system archive log current;
关闭回收站:
SQL> alter system set recyclebin=off scope=spfile;
oracle 9i 无回收站,此部略
复制测试用户为scott,建库是已安装此样板数据库 :
解锁测试用户,并赋予想要的权限,简单起见赋予DBA权限,命令如下:
********************************************************
alter user scott identifieg by scott account unlock;
grant dba to scott;
********************************************************
上述两条命令在gg1,gg2,gg2上均作同样的操作。
目标端gg2配置:
oracle数据库设置
SQL> create user ggs identified by ggs account unlock;
SQL> grant dba to ggs
本次测试目标端未开启归档,未启用附加日志
目标端gg3配置:
oracle数据库设置
SQL> create user ggs identified by ggs account unlock;
SQL> grant dba to ggs
本次测试目标端未开启归档,未启用附加日志
2.6 源端配置抽取进程
启用对象级别附加日志
[oracle@gg1 ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.8.0 - Production on Mon May 12 03:34:46 2014
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect scott/scott
Connected.
SQL> select tanme from tab;
select tanme from tab
*
ERROR at line 1:
ORA-00904: "TANME": invalid identifier
SQL> desc tab;
Name Null? Type
----------------------------------------- -------- ----------------------------
TNAME NOT NULL VARCHAR2(30)
TABTYPE VARCHAR2(7)
CLUSTERID NUMBER
SQL> select tname from tab;
TNAME
------------------------------
BONUS
DEPT
EMP
SALGRADE
[oracle@gg1 ggs]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (gg1.abc.com) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
GGSCI (gg1.abc.com) 2> dblogin userid ggs,password ggs
Successfully logged into database.
GGSCI (gg1.abc.com) 3> add trandata scott.bonus
2014-05-12 03:39:48 WARNING OGG-00869 No unique key is defined for table BONUS. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table SCOTT.BONUS.
GGSCI (gg1.abc.com) 4> add trandata scott.dept
Logging of supplemental redo data enabled for table SCOTT.DEPT.
GGSCI (gg1.abc.com) 5> add trandata scott.emp
Logging of supplemental redo data enabled for table SCOTT.EMP.
GGSCI (gg1.abc.com) 7> add trandata scott.salgrade
2014-05-12 03:40:28 WARNING OGG-00869 No unique key is defined for table SALGRADE. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
Logging of supplemental redo data enabled for table SCOTT.SALGRADE.
GGSCI (gg1.abc.com) 8> edit params ext_my
extract ext_my
dynamicresolution
userid ggs,password ggs
exttrail /home/oracle/ggs/dirdat/my
table scott.*;
"dirprm/ext_my.prm" [New] 5L, 108C written
GGSCI (gg1.abc.com) 9> view params ext_my
extract ext_my
dynamicresolution
userid ggs,password ggs
exttrail /home/oracle/ggs/dirdat/my
table scott.*;
GGSCI (gg1.abc.com) 10> add extract ext_my,tranlog,begin now
EXTRACT added.
GGSCI (gg1.abc.com) 11> add exttrail /home/oracle/ggs/dirdat/my,extract ext_my
EXTTRAIL added.
GGSCI (gg1.abc.com) 12> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_MY 00:00:00 00:00:19
2.7 源端配置泵取进程
源端增加一个推送进程:
GGSCI (gg1.abc.com) 13> edit params pm_my1
extract pm_my1
passthru
dynamicresolution
userid ggs,password ggs
rmthost 192.168.1.202,mgrport 7809
rmttrail /home/oracle/ggs/dirdat/my
table scott.*;
~
"dirprm/pm_my1.prm" [New] 7L, 152C written
GGSCI (gg1.abc.com) 14> view params pm_my1
extract pm_my1
passthru
dynamicresolution
userid ggs,password ggs
rmthost 192.168.1.202,mgrport 7809
rmttrail /home/oracle/ggs/dirdat/my
table scott.*;
添加推送进程读取的本地TRAIL文件:
GGSCI (gg1.abc.com) 15> add extract pm_my1,exttrailsource /home/oracle/ggs/dirdat/my
EXTRACT added.
添加推送进程发送到远端的trail目录:
GGSCI (gg1.abc.com) 16> add rmttrail /home/oracle/ggs/dirdat/my,extract pm_my1
RMTTRAIL added.
查看:
GGSCI (gg1.abc.com) 17> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_MY 00:00:00 00:08:15
EXTRACT STOPPED PM_MY1 00:00:00 00:01:44
源端再增加一个推送进程:
GGSCI (gg1.abc.com) 18> edit params pm_my2
extract pm_my2
passthru
dynamicresolution
userid ggs,password ggs
rmthost 192.168.1.203,mgrport 7809
rmttrail /home/oracle/ggs/dirdat/my
table scott.*;
"dirprm/pm_my2.prm" [New] 7L, 152C written
GGSCI (gg1.abc.com) 19> view params pm_my2
extract pm_my2
passthru
dynamicresolution
userid ggs,password ggs
rmthost 192.168.1.203,mgrport 7809
rmttrail /home/oracle/ggs/dirdat/my
table scott.*;
添加推送进程读取的本地TRAIL文件:
GGSCI (gg1.abc.com) 20> add extract pm_my2,exttrailsource /home/oracle/ggs/dirdat/my
EXTRACT added.
添加推送进程发送到远端的trail目录:
GGSCI (gg1.abc.com) 21> add rmttrail /home/oracle/ggs/dirdat/my,extract pm_my2
RMTTRAIL added.
查看:
GGSCI (gg1.abc.com) 22> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_MY 00:00:00 00:10:47
EXTRACT STOPPED PM_MY1 00:00:00 00:04:16
EXTRACT STOPPED PM_MY2 00:00:00 00:00:41
可以看到源端管理进程、抽取进程、泵取进程pm_my1、泵取进程pm_my2以配置完成,但未启动,下面开始
两个目标端测试用户的实例化
2.8 源端测试用户及目标端测试用户的实例化
实例化方式1:
本次测试的两个目标端及源端均是同一虚拟机克隆的快照,克隆前的虚拟机以安装数据库,并建立数据库测试用户,故
三个数据库的用户SCOTT的表对象处于一致的状态,可省略初始化过程
实例化方式2:
exp/imp 方式实例化
Example 2: schema export using exp
Enable Minimal Supplemental Logging in Oracle on source
SQLPLUS > alter database add supplemental log data;
Enable Supplemental Logging at Table Level on source
GGSCI> dblogin userid xxxxx password xxxxxx
GGSCI> add trandata <schema>.<tablename>
Add Extract, Add ExtTrail FileTrail File, Add Pump, Add RmtTrail FileTrail File on source
Start Extract, Start Pump on source
Get the current SCN on the source database:
SQLPLUS> select current_scn from v$database ;
CURRENT_SCN
-----------------------28318029
Get a flashback snapshot from the SCN that you obtained in the previous step. You can do this with
exp or expdp utility. The following example shows the use of export utility (exp):
>exp <username>/<password> owner=<schema_name> grants=n statistics=none triggers=n
compress=n FLASHBACK_SCN=28318029
Note: Undo_retention has to be set high enough, and the export log needs to be checked for errors.
You can speed up exp by running multiple session in parallel but you have to manually configure
subsets of the data you want to export (e.g. different tables for different export files). Make sure to use
the same FLASHBACK_SCN for all export sessions to ensure taking a read consistent backup.
Start an import to the target database when export is complete.
Add and Start Replicat:
GGSCI> add replicat <rename>, exttrail ./dirdat/<xx>
GGSCI> start replicat <rename>, aftercsn <SCN value returned from query on source>
3.0 目标端配置复制进程
gg2:
[oracle@gg2 ggs]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (gg2.abc.com) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
GGSCI (gg2.abc.com) 2> dblogin userid ggs,password ggs
Successfully logged into database.
GGSCI (gg2.abc.com) 3> edit params rep
replicat rep
userid ggs, password ggs
handlecollisons
assumetargetdefs
map scott.*, target scott.*;
"dirprm/rep.prm" [New] 5L, 100C written
GGSCI (gg2.abc.com) 4> view params rep
replicat rep
userid ggs, password ggs
handlecollisons
assumetargetdefs
map scott.*, target scott.*;
GGSCI (gg2.abc.com) 5> dblogin userid ggs,password ggs
Successfully logged into database.
GGSCI (gg2.abc.com) 7> add replicat rep, nodbcheckpoint, exttrail /home/oracle/ggs/dirdat/my
REPLICAT added.
GGSCI (gg2.abc.com) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:00:06
gg3:
[oracle@gg3 ggs]$ pwd
/home/oracle/ggs
[oracle@gg3 ggs]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (gg3.abc.com) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
GGSCI (gg3.abc.com) 2> dblogin userid ggs,password ggs
Successfully logged into database.
GGSCI (gg3.abc.com) 3> edit params rep
replicat rep
userid ggs, password ggs
handlecollisons
assumetargetdefs
map scott.*, target scott.*;
"dirprm/rep.prm" [New] 5L, 100C written
GGSCI (gg3.abc.com) 4> view params rep
replicat rep
userid ggs, password ggs
handlecollisons
assumetargetdefs
map scott.*, target scott.*;
GGSCI (gg3.abc.com) 5> dblogin userid ggs,password ggs
Successfully logged into database.
GGSCI (gg3.abc.com) 6> add replicat rep, nodbcheckpoint, exttrail /home/oracle/ggs/dirdat/my
REPLICAT added.
GGSCI (gg3.abc.com) 7> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:00:21
3.1 测试源端及目标端数据是否同步
开启源端抽取及泵取进程:
GGSCI (gg1.abc.com) 26> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_MY 00:00:00 00:45:26
EXTRACT STOPPED PM_MY1 00:00:00 00:38:55
EXTRACT STOPPED PM_MY2 00:00:00 00:35:20
GGSCI (gg1.abc.com) 27> start pm_my1
Sending START request to MANAGER ...
EXTRACT PM_MY1 starting
GGSCI (gg1.abc.com) 28> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT_MY 00:00:00 00:46:22
EXTRACT RUNNING PM_MY1 00:00:00 00:39:51
EXTRACT STOPPED PM_MY2 00:00:00 00:36:16
GGSCI (gg1.abc.com) 29> start ext_my
Sending START request to MANAGER ...
EXTRACT EXT_MY starting
GGSCI (gg1.abc.com) 30> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_MY 00:46:31 00:00:00
EXTRACT RUNNING PM_MY1 00:00:00 00:00:06
EXTRACT STOPPED PM_MY2 00:00:00 00:36:25
GGSCI (gg1.abc.com) 31> start pm_my2
Sending START request to MANAGER ...
EXTRACT PM_MY2 starting
GGSCI (gg1.abc.com) 32> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_MY 00:46:31 00:00:07
EXTRACT RUNNING PM_MY1 00:00:00 00:00:02
EXTRACT RUNNING PM_MY2 00:00:00 00:36:31
开启目标端复制进程:
GGSCI (gg2.abc.com) 8> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:00:06
GGSCI (gg2.abc.com) 9>
GGSCI (gg2.abc.com) 9>
GGSCI (gg2.abc.com) 9>
GGSCI (gg2.abc.com) 9> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:07:44
GGSCI (gg2.abc.com) 10> start rep
ERROR: You must specify a group name.
GGSCI (gg2.abc.com) 11> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:09:54
GGSCI (gg2.abc.com) 12> start rep
ERROR: You must specify a group name.
GGSCI (gg2.abc.com) 13> start rep rep
Sending START request to MANAGER ...
REPLICAT REP starting
GGSCI (gg2.abc.com) 14> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:10:32
GGSCI (gg2.abc.com) 15> exit
[oracle@gg2 ggs]$ more ggserr.log
2014-05-12 02:24:32 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): edit params mgr.
2014-05-12 02:24:42 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): start mgr.
2014-05-12 02:24:42 INFO OGG-00983 Oracle GoldenGate Manager for Oracle, mg
r.prm: Manager started (port 7809).
2014-05-12 04:18:58 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): edit params rep.
2014-05-12 04:21:47 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): add replicat rep nodbcheckpoint, extrail /ho
me/oracle/ggs/dirdat/my.
2014-05-12 04:22:28 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): add replicat rep nodbcheckpoint, exttrail /h
ome/oracle/ggs/dirdat/my.
2014-05-12 04:31:02 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mg
r.prm: Command received from EXTRACT on host 192.168.1.201 (START SERVER CPU -1
PRI -1 TIMEOUT 300 PARAMS ).
2014-05-12 04:31:02 INFO OGG-00974 Oracle GoldenGate Manager for Oracle, mg
r.prm: Manager started collector process (Port 7840).
2014-05-12 04:31:02 INFO OGG-01677 Oracle GoldenGate Collector: Waiting fo
r connection (started dynamically).
2014-05-12 04:31:02 INFO OGG-01228 Oracle GoldenGate Collector: Timeout in
300 seconds.
2014-05-12 04:31:07 INFO OGG-01229 Oracle GoldenGate Collector: Connected
to 192.168.1.201:32800.
2014-05-12 04:31:07 INFO OGG-01669 Oracle GoldenGate Collector: Opening /h
ome/oracle/ggs/dirdat/my000000 (byte -1, current EOF 0).
2014-05-12 04:32:15 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): start rep.
2014-05-12 04:32:25 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): start rep.
2014-05-12 04:32:58 INFO OGG-00987 Oracle GoldenGate Command Interpreter fo
r Oracle: GGSCI command (oracle): start rep rep.
2014-05-12 04:32:58 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mg
r.prm: Command received from GGSCI on host 192.168.1.202 (START REPLICAT REP ).
2014-05-12 04:32:58 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mg
r.prm: REPLICAT REP starting.
2014-05-12 04:32:58 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, r
ep.prm: REPLICAT REP starting.
2014-05-12 04:32:58 ERROR OGG-00014 Oracle GoldenGate Delivery for Oracle, r
ep.prm: Unrecognized parameter: handlecollisons. Parameter could be misspelled
or unsupported.
2014-05-12 04:32:58 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, r
ep.prm: PROCESS ABENDING.
[oracle@gg2 ggs]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100
Linux, x64, 64bit (optimized), Oracle 9i on Oct 4 2011 23:49:32
Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
GGSCI (gg2.abc.com) 1> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP 00:00:00 00:11:14
GGSCI (gg2.abc.com) 2> edit params rep
replicat rep
userid ggs, password ggs
--handlecollisons
assumetargetdefs
map scott.*, target scott.*;
"dirprm/rep.prm" 5L, 102C written
GGSCI (gg2.abc.com) 3> start rep rep
Sending START request to MANAGER ...
REPLICAT REP starting
GGSCI (gg2.abc.com) 4> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP 00:00:00 00:00:01
GGSCI (gg2.abc.com) 5>
测试l;
GGSCI (gg1.abc.com) 34> exit
[oracle@gg1 ggs]$ sqlplus scott/scott
SQL*Plus: Release 9.2.0.8.0 - Production on Mon May 12 04:40:56 2014
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select tname from tab;
TNAME
------------------------------
BONUS
DEPT
EMP
SALGRADE
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7839 KING PRESIDENT 17-NOV-81 5000
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10
14 rows selected.
SQL> delete from emp where empno=7934;
1 row deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from emp;
COUNT(*)
----------
13
[oracle@gg2 ggs]$ sqlplus scott/scott
SQL*Plus: Release 9.2.0.8.0 - Production on Mon May 12 04:42:03 2014
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select count(*) from emp;
COUNT(*)
----------
13
[oracle@gg3 ggs]$ sqlplus scott/scott
SQL*Plus: Release 9.2.0.8.0 - Production on Mon May 12 04:42:16 2014
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select count(*) from emp;
COUNT(*)
----------
13
|
|