Oracle RAC环境下配置goldengate同步及注意事项
Oracle RAC环境下配置goldengate同步及注意事项
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,](转载)在本文中,介绍了rac环境下配置ogg的单向同步;在配置过程中,2节点的rac数据库做为source端,单实例的数据库作为target端,下面是具体的环境介绍!
source端:
操作系统版本:rhel5.4 64bit
数据库版本:11.2.0.3 64bit
ogg版本:fbo_ggs_Linux_x64_ora10g_64bit.tar
rac数据库名:rac.yang.com
public ip:192.168.1.41/24,192.168.1.42/24
private ip:192.168.122.41/24,192.168.122.42/24
vip:192.168.1.141/24,192.168.1.142/24
scan名:rac-scan.yang.com
scan-ip:192.168.1.144/24,192.168.1.145/24,192.168.1.146/24[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]target端:
操作系统版本:rhel5.4 64bit
数据库版本:11.2.0.3 64bit
ogg版本:fbo_ggs_Linux_x64_ora10g_64bit.tar
数据库名:dg3.yang.com
ip:192.168.1.63/24
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]一:首先在两个rac节点上配置ASM动态注册,11g的监听器引入了endpoints_listener.ora文件管理[list=1]
[*][backcolor=inherit][grid@rac1 rac1]$ srvctl status listener
[*][backcolor=inherit]Listener LISTENER is enabled
[*][backcolor=inherit]Listener LISTENER is running on node(s): rac2,rac1
[*][backcolor=inherit]
[*][backcolor=inherit][grid@rac1 rac1]$ lsnrctl services
[*][backcolor=inherit]LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-JUL-2012 21:09:20
[*][backcolor=inherit]Copyright (c) 1991, 2011, Oracle. All rights reserved.
[*][backcolor=inherit]
[*][backcolor=inherit]Connecting to ([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]IPC[backcolor=inherit])([backcolor=inherit]KEY[backcolor=inherit]=[backcolor=inherit]LISTENER[backcolor=inherit])))
[*][backcolor=inherit]Services Summary...
[*][backcolor=inherit]Service "+ASM" has 1 instance(s).
[*][backcolor=inherit] Instance "+ASM1", status READY, has 1 handler(s) for this service...
[*][backcolor=inherit] Handler(s):
[*][backcolor=inherit] "DEDICATED" established:0 refused:0 state:ready
[*][backcolor=inherit] LOCAL SERVER
[*][backcolor=inherit]Service "rac.yang.com" has 1 instance(s).
[*][backcolor=inherit] Instance "rac1", status READY, has 1 handler(s) for this service...
[*][backcolor=inherit] Handler(s):
[*][backcolor=inherit] "DEDICATED" established:0 refused:0 state:ready
[*][backcolor=inherit] LOCAL SERVER
[*][backcolor=inherit]Service "racXDB.yang.com" has 1 instance(s).
[*][backcolor=inherit] Instance "rac1", status READY, has 1 handler(s) for this service...
[*][backcolor=inherit] Handler(s):
[*][backcolor=inherit] "D000" established:0 refused:0 current:0 max:1022 state:ready
[*][backcolor=inherit] DISPATCHER [color=rgb(0, 102, 153)][backcolor=inherit]<[color=rgb(0, 102, 153)][backcolor=inherit]machine:[backcolor=inherit] rac1.yang.com, pid: 5183[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit]
[*][backcolor=inherit] ([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]tcp[backcolor=inherit])([backcolor=inherit]HOST[backcolor=inherit]=[backcolor=inherit]rac1[backcolor=inherit].yang.com)([backcolor=inherit]PORT[backcolor=inherit]=[backcolor=inherit]63054[backcolor=inherit]))
[*][backcolor=inherit]The command completed successfully
[*][backcolor=inherit]
[*][backcolor=inherit][grid@rac1 rac1]$ cat $TNS_ADMIN/listener.ora
[*][backcolor=inherit]LISTENER[backcolor=inherit]=([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS_LIST[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]IPC[backcolor=inherit])([backcolor=inherit]KEY[backcolor=inherit]=[backcolor=inherit]LISTENER[backcolor=inherit])))) # line added by Agent
[*][backcolor=inherit]LISTENER_SCAN3[backcolor=inherit]=([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS_LIST[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]IPC[backcolor=inherit])([backcolor=inherit]KEY[backcolor=inherit]=[backcolor=inherit]LISTENER_SCAN3[backcolor=inherit])))) # line added by Agent
[*][backcolor=inherit]LISTENER_SCAN2[backcolor=inherit]=([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS_LIST[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]IPC[backcolor=inherit])([backcolor=inherit]KEY[backcolor=inherit]=[backcolor=inherit]LISTENER_SCAN2[backcolor=inherit])))) # line added by Agent
[*][backcolor=inherit]LISTENER_SCAN1[backcolor=inherit]=([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS_LIST[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]IPC[backcolor=inherit])([backcolor=inherit]KEY[backcolor=inherit]=[backcolor=inherit]LISTENER_SCAN1[backcolor=inherit])))) # line added by Agent
[*][backcolor=inherit]ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1[backcolor=inherit]=[backcolor=inherit]ON[backcolor=inherit] # line added by Agent
[*][backcolor=inherit]ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2[backcolor=inherit]=[backcolor=inherit]ON[backcolor=inherit] # line added by Agent
[*][backcolor=inherit]ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3[backcolor=inherit]=[backcolor=inherit]ON[backcolor=inherit] # line added by Agent
[*][backcolor=inherit]ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER[backcolor=inherit]=[backcolor=inherit]ON[backcolor=inherit] # line added by Agent
[*][backcolor=inherit]
[*][backcolor=inherit][grid@rac1 rac1]$ cat /u01/app/11.2.0/grid/network/admin/endpoints_listener.ora
[*][backcolor=inherit]LISTENER_RAC1[backcolor=inherit]=([backcolor=inherit]DESCRIPTION[backcolor=inherit]=([backcolor=inherit]ADDRESS_LIST[backcolor=inherit]=([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]TCP[backcolor=inherit])([backcolor=inherit]HOST[backcolor=inherit]=[backcolor=inherit]rac1[backcolor=inherit]-vip)([backcolor=inherit]PORT[backcolor=inherit]=[backcolor=inherit]1521[backcolor=inherit]))([backcolor=inherit]ADDRESS[backcolor=inherit]=([backcolor=inherit]PROTOCOL[backcolor=inherit]=[backcolor=inherit]TCP[backcolor=inherit]) [backcolor=inherit]([backcolor=inherit]HOST[backcolor=inherit]=[backcolor=inherit]192[backcolor=inherit].168.1.41)([backcolor=inherit]PORT[backcolor=inherit]=[backcolor=inherit]1521[backcolor=inherit])([backcolor=inherit]IP[backcolor=inherit]=[backcolor=inherit]FIRST[backcolor=inherit])))) # line added by Agent
[*][backcolor=inherit]
[*][backcolor=inherit][grid@rac1 rac1]$ tail -8 $TNS_ADMIN/listener.ora
[*][backcolor=inherit]SID_LIST_LISTENER[backcolor=inherit] =
[*][backcolor=inherit]([backcolor=inherit]SID_LIST[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]SID_DESC[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]GLOBAL_DBNAME[backcolor=inherit] = +ASM)
[*][backcolor=inherit] ([backcolor=inherit]ORACLE_HOME[backcolor=inherit]=/u01/app/11.2.0/grid)
[*][backcolor=inherit] ([backcolor=inherit]SID_NAME[backcolor=inherit] = +ASM1)
[*][backcolor=inherit] )
[*][backcolor=inherit])
[*][backcolor=inherit]
[*][backcolor=inherit][grid@rac2 ~]$ tail -8 $TNS_ADMIN/listener.ora
[*][backcolor=inherit]SID_LIST_LISTENER[backcolor=inherit] =
[*][backcolor=inherit]([backcolor=inherit]SID_LIST[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]SID_DESC[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]GLOBAL_DBNAME[backcolor=inherit] = +ASM)
[*][backcolor=inherit] ([backcolor=inherit]ORACLE_HOME[backcolor=inherit]=/u01/app/11.2.0/grid)
[*][backcolor=inherit] ([backcolor=inherit]SID_NAME[backcolor=inherit] = +ASM2)
[*][backcolor=inherit] )
[*][backcolor=inherit])
[*][backcolor=inherit]
[*][backcolor=inherit][oracle@rac1 ~]$ sqlplus sys/123456@192.168.1.41:1521/+ASM as sysdba
[*][backcolor=inherit]SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 11 21:31:30 2012
[*][backcolor=inherit]Copyright (c) 1982, 2011, Oracle. All rights reserved.
[*][backcolor=inherit]
[*][backcolor=inherit]Connected to:
[*][backcolor=inherit]Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
[*][backcolor=inherit]With the Real Application Clusters and Automatic Storage Management options
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] show parameter name;
[*][backcolor=inherit]
[*][backcolor=inherit]NAME TYPE VALUE
[*][backcolor=inherit]------------------------------------ ----------- ------------------------------
[*][backcolor=inherit]db_unique_name string +ASM
[*][backcolor=inherit]instance_name string +ASM1
[*][backcolor=inherit]lock_name_space string
[*][backcolor=inherit]service_names string +ASM
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] conn sys/123456@192.168.1.42:1521/+ASM as sysdba
[*][backcolor=inherit]Connected.
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] show parameter name;
[*][backcolor=inherit]
[*][backcolor=inherit]NAME TYPE VALUE
[*][backcolor=inherit]------------------------------------ ----------- ------------------------------
[*][backcolor=inherit]db_unique_name string +ASM
[*][backcolor=inherit]instance_name string +ASM2
[*][backcolor=inherit]lock_name_space string
[*][backcolor=inherit]service_names string +ASM
[*][backcolor=inherit]
[*][backcolor=inherit][oracle@rac1 admin]$ cat tnsnames.ora //节点2的tnsnames.ora文件做相应的配置
[*][backcolor=inherit]RAC[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]DESCRIPTION[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]ADDRESS[backcolor=inherit] = ([backcolor=inherit]PROTOCOL[backcolor=inherit] = [backcolor=inherit]TCP[backcolor=inherit])([backcolor=inherit]HOST[backcolor=inherit] = [backcolor=inherit]rac[backcolor=inherit]-scan)([backcolor=inherit]PORT[backcolor=inherit] = [backcolor=inherit]1521[backcolor=inherit]))
[*][backcolor=inherit] ([backcolor=inherit]CONNECT_DATA[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]SERVER[backcolor=inherit] = [backcolor=inherit]DEDICATED[backcolor=inherit])
[*][backcolor=inherit] ([backcolor=inherit]SERVICE_NAME[backcolor=inherit] = [backcolor=inherit]rac[backcolor=inherit].yang.com)
[*][backcolor=inherit] )
[*][backcolor=inherit] )
[*][backcolor=inherit]
[*][backcolor=inherit]ASM[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]DESCRIPTION[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]ADDRESS[backcolor=inherit] = ([backcolor=inherit]PROTOCOL[backcolor=inherit] = [backcolor=inherit]TCP[backcolor=inherit])([backcolor=inherit]HOST[backcolor=inherit] = [backcolor=inherit]192[backcolor=inherit].168.1.41)([backcolor=inherit]PORT[backcolor=inherit] = [backcolor=inherit]1521[backcolor=inherit]))
[*][backcolor=inherit] ([backcolor=inherit]CONNECT_DATA[backcolor=inherit] =
[*][backcolor=inherit] ([backcolor=inherit]SERVER[backcolor=inherit] = [backcolor=inherit]DEDICATED[backcolor=inherit])
[*][backcolor=inherit] ([backcolor=inherit]SERVICE_NAME[backcolor=inherit] = +ASM)
[*][backcolor=inherit] ([backcolor=inherit]SID_NAME[backcolor=inherit] = +ASM1)
[*][backcolor=inherit] )
[*][backcolor=inherit] )
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]二:acfs上安装ogg,acfs用来存放ogg的安装目录,便于集群件的共享,在10g上部署可以选择ocfs2,acfs的部署过程参考:[color=#789d20]http://ylw6006.blog.51cto.com/470441/925545]http://ylw6006.blog.51cto.com/470441/925545[list=1]
[*][backcolor=inherit][root@rac1 ~]# ll -d /vol2/
[*][backcolor=inherit]drwxrwx--- 4 root asmadmin 4096 Jul 9 09:38 /vol2/
[*][backcolor=inherit][root@rac1 ~]# id oracle
[*][backcolor=inherit]uid[backcolor=inherit]=[backcolor=inherit]501[backcolor=inherit](oracle) [backcolor=inherit]gid[backcolor=inherit]=[backcolor=inherit]500[backcolor=inherit](oinstall) [backcolor=inherit]groups[backcolor=inherit]=[backcolor=inherit]500[backcolor=inherit](oinstall),502(asmdba),504(dba),505(oper)
[*][backcolor=inherit][root@rac1 ~]# chown -R oracle.asmadmin /vol2/ (节点2做同样的操作)
[*][backcolor=inherit][root@rac1 ~]# ll -d /vol2/
[*][backcolor=inherit]drwxrwx--- 4 oracle asmadmin 4096 Jul 9 09:38 /vol2/
[*][backcolor=inherit]
[*][backcolor=inherit][root@rac1 ~]# su - oracle
[*][backcolor=inherit][oracle@rac1 ~]$ mkdir -p /vol2/ogg
[*][backcolor=inherit][oracle@rac1 ogg]$ tar -xvf /home/oracle/fbo_ggs_Linux_x64_ora11g_64bit.tar
[*][backcolor=inherit]
[*][backcolor=inherit][oracle@rac1 ~]$ grep 'LD_LIBRARY_PATH' .bash_profile (节点2做同样的操作)
[*][backcolor=inherit]export [backcolor=inherit]LIBRARY_PATH[backcolor=inherit]=/vol2/ogg:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
[*][backcolor=inherit][oracle@rac1 ~]$ source .bash_profile
[*][backcolor=inherit][oracle@rac1 ~]$ cd -
[*][backcolor=inherit]/vol2/ogg
[*][backcolor=inherit][oracle@rac1 ogg]$ ./ggsci
[*][backcolor=inherit]Oracle GoldenGate Command Interpreter for Oracle
[*][backcolor=inherit]Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
[*][backcolor=inherit]Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
[*][backcolor=inherit]
[*][backcolor=inherit]Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] create subdirs
[*][backcolor=inherit]
[*][backcolor=inherit]Creating subdirectories under current directory /vol2/ogg
[*][backcolor=inherit]
[*][backcolor=inherit]Parameter files /vol2/ogg/dirprm: already exists
[*][backcolor=inherit]Report files /vol2/ogg/dirrpt: created
[*][backcolor=inherit]Checkpoint files /vol2/ogg/dirchk: created
[*][backcolor=inherit]Process status files /vol2/ogg/dirpcs: created
[*][backcolor=inherit]SQL script files /vol2/ogg/dirsql: created
[*][backcolor=inherit]Database definitions files /vol2/ogg/dirdef: created
[*][backcolor=inherit]Extract data files /vol2/ogg/dirdat: created
[*][backcolor=inherit]Temporary files /vol2/ogg/dirtmp: created
[*][backcolor=inherit]Stdout files /vol2/ogg/dirout: created
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] view params mgr
[*][backcolor=inherit]port 7809
[*][backcolor=inherit]autostart er *
[*][backcolor=inherit]autorestart er *
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] start mgr
[*][backcolor=inherit]Manager started.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] info mgr
[*][backcolor=inherit]Manager is running (IP port rac1.yang.com.7809).
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] exit
[*][backcolor=inherit]
[*][backcolor=inherit][oracle@rac1 ogg]$ netstat -ntpl |grep 7809
[*][backcolor=inherit](Not all processes could be identified, non-owned process info
[*][backcolor=inherit] will not be shown, you would have to be root to see it all.)
[*][backcolor=inherit]tcp 0 0 :::7809 :::* LISTEN 10622/mgr
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]三:rac数据库上进行配置,创建用户,授权,运行执行序列号和ddl复制的相关脚本等[list=1]
[*][backcolor=inherit][oracle@rac1 ogg]$ sqlplus sys/123456@rac as sysdba
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] select instance_name from v$instance;
[*][backcolor=inherit]
[*][backcolor=inherit]INSTANCE_NAME
[*][backcolor=inherit]----------------
[*][backcolor=inherit]rac2
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] create user ogg identified by ogg;
[*][backcolor=inherit]User created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant connect,resource,dba to ogg;
[*][backcolor=inherit]Grant succeeded.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @sequence.sql
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] alter database add supplemental log data;
[*][backcolor=inherit]Database altered.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] alter database add supplemental log data (primary key) columns;
[*][backcolor=inherit]Database altered.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] alter database add supplemental log data (foreign key) columns;
[*][backcolor=inherit]Database altered.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] alter database add supplemental log data (unique) columns;
[*][backcolor=inherit]Database altered.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] alter system archive log current;
[*][backcolor=inherit]System altered.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant execute on utl_file to ogg;
[*][backcolor=inherit]Grant succeeded.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @marker_setup.sql
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @ddl_setup.sql
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @role_setup.sql
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant ggs_ggsuser_role to ogg;
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @ddl_enable.sql
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] @ddl_pin ogg
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]四:在source端配置extract group[list=1]
[*][backcolor=inherit]SQL> create user test identified by test;
[*][backcolor=inherit]User created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant connect,resource to test;
[*][backcolor=inherit]Grant succeeded.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] dblogin userid ogg,password ogg
[*][backcolor=inherit]Successfully logged into database.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] add extract testext,tranlog,begin now,threads 2
[*][backcolor=inherit]EXTRACT added.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] add exttrail /vol2/ogg/dirdat/et, extract testext
[*][backcolor=inherit]EXTTRAIL added.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] view params testext
[*][backcolor=inherit]EXTRACT testext
[*][backcolor=inherit]SETENV ([backcolor=inherit]ORACLE_HOME[backcolor=inherit] = [backcolor=inherit]"/u01/app/oracle/product/11.2.0/db1"[backcolor=inherit])
[*][backcolor=inherit]USERID ogg@rac, PASSWORD ogg
[*][backcolor=inherit]TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD 123456
[*][backcolor=inherit]THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
[*][backcolor=inherit]EXTTRAIL /vol2/ogg/dirdat/et
[*][backcolor=inherit]DYNAMICRESOLUTION
[*][backcolor=inherit]DDL INCLUDE ALL
[*][backcolor=inherit]TABLE test.*;
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]五:在source端配置data pump extract group[list=1]
[*][backcolor=inherit]GGSCI (rac1.yang.com) > add extract testpump,exttrailsource /vol2/ogg/dirdat/et,begin now
[*][backcolor=inherit]EXTRACT added.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] add rmttrail /vol2/ogg/dirdat/rt,extract testpump
[*][backcolor=inherit]RMTTRAIL added.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] view params testpump
[*][backcolor=inherit]EXTRACT testpump
[*][backcolor=inherit]RMTHOST 192.168.1.63, MGRPORT 7809
[*][backcolor=inherit]RMTTRAIL /vol2/ogg/dirdat/rt
[*][backcolor=inherit]PASSTHRU
[*][backcolor=inherit]TABLE test.*
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]六:target端配置,这里要保证在tnsnames.ora文件中配置了dg3连接串,同时建立/vol2/ogg/dirdat/rt目录,并授权;在这里未测试过target端和source使用不同的目录是否可行![list=1]
[*][backcolor=inherit]SQL> create user ogg identified by ogg;
[*][backcolor=inherit]User created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant connect,resource,dba to ogg;
[*][backcolor=inherit]Grant succeeded.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] create user test identified by test;
[*][backcolor=inherit]User created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] grant connect,resource to test;
[*][backcolor=inherit]Grant succeeded.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (dg3.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] add replicat testrpt,exttrail /vol2/ogg/dirdat/rt,nodbcheckpoint
[*][backcolor=inherit]REPLICAT added.
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (dg3.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] view params testrpt
[*][backcolor=inherit]REPLICAT testrpt
[*][backcolor=inherit]SETENV ([backcolor=inherit]ORACLE_HOME[backcolor=inherit] = [backcolor=inherit]"/u01/app/oracle/product/11.2.0/db1"[backcolor=inherit])
[*][backcolor=inherit]USERID ogg@dg3,PASSWORD ogg
[*][backcolor=inherit]ASSUMETARGETDEFS
[*][backcolor=inherit]HANDLECOLLISIONS
[*][backcolor=inherit]REPERROR (DEFAULT, DISCARD)
[*][backcolor=inherit]DDLERROR DEFAULT DISCARD
[*][backcolor=inherit]DDLOPTIONS REPORT
[*][backcolor=inherit]DISCARDFILE /vol2/ogg/repsz.dsc,append,megabytes 100
[*][backcolor=inherit]MAP test.*, TARGET test.*;
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]七:启动各进程[list=1]
[*][backcolor=inherit]GGSCI (rac1.yang.com) > start testext
[*][backcolor=inherit]Sending START request to MANAGER ...
[*][backcolor=inherit]EXTRACT TESTEXT starting
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] start testpump
[*][backcolor=inherit]Sending START request to MANAGER ...
[*][backcolor=inherit]EXTRACT TESTPUMP starting
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (rac1.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] info all
[*][backcolor=inherit]
[*][backcolor=inherit]Program Status Group Lag at Chkpt Time Since Chkpt
[*][backcolor=inherit]MANAGER RUNNING
[*][backcolor=inherit]EXTRACT RUNNING TESTEXT 00:00:00 00:19:49
[*][backcolor=inherit]EXTRACT RUNNING TESTPUMP 00:00:00 00:03:24
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (dg3.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] start testrpt
[*][backcolor=inherit]Sending START request to MANAGER ...
[*][backcolor=inherit]REPLICAT TESTRPT starting
[*][backcolor=inherit]
[*][backcolor=inherit]GGSCI (dg3.yang.com) [color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] info all
[*][backcolor=inherit]Program Status Group Lag at Chkpt Time Since Chkpt
[*][backcolor=inherit]
[*][backcolor=inherit]MANAGER RUNNING
[*][backcolor=inherit]REPLICAT RUNNING TESTRPT 00:00:00 00:00:02
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]进程安排在最后启动,在启动source端的pump进程之前,如果target端的replicat进程未启动,则会报如下错误:
2012-07-15 13:56:14 ERROR OGG-01033 There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Remote file used is /vol2/ogg/dirdat/rt000000, reply received is Could not create /vol2/ogg/dirdat/rt000000).
[p=28, null, left][color=rgb(44, 44, 44)][font=宋体,]八:测试同步情况[list=1]
[*][backcolor=inherit][oracle@rac1 ~]$ sqlplus test/test@rac
[*][backcolor=inherit]SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:11:52 2012
[*][backcolor=inherit]Copyright (c) 1982, 2011, Oracle. All rights reserved.
[*][backcolor=inherit]
[*][backcolor=inherit]Connected to:
[*][backcolor=inherit]Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
[*][backcolor=inherit]With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
[*][backcolor=inherit]OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] create table t1 (id number,name char(10));
[*][backcolor=inherit]Table created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] desc t1;
[*][backcolor=inherit] Name Null? Type
[*][backcolor=inherit] ----------------------------------------- -------- ----------------------------
[*][backcolor=inherit] ID NUMBER
[*][backcolor=inherit] NAME CHAR(10)
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] insert into t1 values (1,'one');
[*][backcolor=inherit]1 row created.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] commit;
[*][backcolor=inherit]Commit complete.
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] select * from t1;
[*][backcolor=inherit]
[*][backcolor=inherit] ID NAME
[*][backcolor=inherit]---------- ----------
[*][backcolor=inherit] 1 one
[*][backcolor=inherit]
[*][backcolor=inherit][oracle@dg3 ~]$ sqlplus test/test@dg3
[*][backcolor=inherit]SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:12:31 2012
[*][backcolor=inherit]Copyright (c) 1982, 2011, Oracle. All rights reserved.
[*][backcolor=inherit]
[*][backcolor=inherit]Connected to:
[*][backcolor=inherit]Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
[*][backcolor=inherit]With the Partitioning, OLAP, Data Mining and Real Application Testing options
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] select * from tab;
[*][backcolor=inherit]
[*][backcolor=inherit]TNAME TABTYPE CLUSTERID
[*][backcolor=inherit]------------------------------ ------- ----------
[*][backcolor=inherit]T1 TABLE
[*][backcolor=inherit]
[*][backcolor=inherit]SQL[color=rgb(0, 102, 153)][backcolor=inherit]>[backcolor=inherit] select * from t1;
[*][backcolor=inherit]
[*][backcolor=inherit] ID NAME
[*][backcolor=inherit]---------- ----------
[*][backcolor=inherit] 1 one
[p=28, null, left][font=宋体,]总结:rac环境下配置ogg,基本同单实例无异!重点需要注意的地方有以下几点!
1:使用ASM存储,需要先配置ASM实例的静态注册,同时在tnsnames.ora文件中配置连接串
2:在配置exttract进程中,注意需要配置TRANLOGOPTIONS 参数,输入连接asm实例的凭证
3:在配置exttract进程中,添加tranlog的时候,需要写thread 2
4: 注意进程的启动顺序,先是source和target端的mgr进程,其次是source端的extract进程,target端的replicat进程,最后是source端的extract pump进程