RAC环境下配置OGG同步

简介:

在本文中,介绍了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

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

一:首先在两个rac节点上配置ASM动态注册,11g的监听器引入了endpoints_listener.ora文件管理

 
  1. [grid@rac1 rac1]$ srvctl status listener  
  2. Listener LISTENER is enabled  
  3. Listener LISTENER is running on node(s): rac2,rac1  
  4.  
  5. [grid@rac1 rac1]$ lsnrctl services  
  6. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-JUL-2012 21:09:20  
  7. Copyright (c) 1991, 2011, Oracle.  All rights reserved.  
  8.  
  9. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))  
  10. Services Summary...  
  11. Service "+ASM" has 1 instance(s).  
  12.   Instance "+ASM1", status READY, has 1 handler(s) for this service...  
  13.     Handler(s):  
  14.       "DEDICATED" established:0 refused:0 state:ready  
  15.          LOCAL SERVER  
  16. Service "rac.yang.com" has 1 instance(s).  
  17.   Instance "rac1", status READY, has 1 handler(s) for this service...  
  18.     Handler(s):  
  19.       "DEDICATED" established:0 refused:0 state:ready  
  20.          LOCAL SERVER  
  21. Service "racXDB.yang.com" has 1 instance(s).  
  22.   Instance "rac1", status READY, has 1 handler(s) for this service...  
  23.     Handler(s):  
  24.       "D000" established:0 refused:0 current:0 max:1022 state:ready  
  25.          DISPATCHER <machine: rac1.yang.com, pid: 5183> 
  26.          (ADDRESS=(PROTOCOL=tcp)(HOST=rac1.yang.com)(PORT=63054))  
  27. The command completed successfully  
  28.  
  29. [grid@rac1 rac1]$ cat $TNS_ADMIN/listener.ora  
  30. LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent  
  31. LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))))  # line added by Agent  
  32. LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))))  # line added by Agent  
  33. LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))  # line added by Agent  
  34. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent  
  35. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON                # line added by Agent  
  36. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON                # line added by Agent  
  37. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent  
  38.  
  39. [grid@rac1 rac1]$ cat /u01/app/11.2.0/grid/network/admin/endpoints_listener.ora   
  40. LISTENER_RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)  (HOST=192.168.1.41)(PORT=1521)(IP=FIRST))))              # line added by Agent  
  41.  
  42. [grid@rac1 rac1]$ tail -8  $TNS_ADMIN/listener.ora  
  43. SID_LIST_LISTENER =  
  44. (SID_LIST =  
  45.  (SID_DESC =  
  46.   (GLOBAL_DBNAME = +ASM)  
  47.   (ORACLE_HOME=/u01/app/11.2.0/grid)  
  48.   (SID_NAME = +ASM1)  
  49.  )  
  50. )  
  51.  
  52. [grid@rac2 ~]$ tail -8  $TNS_ADMIN/listener.ora  
  53. SID_LIST_LISTENER =  
  54. (SID_LIST =  
  55.  (SID_DESC =  
  56.   (GLOBAL_DBNAME = +ASM)  
  57.   (ORACLE_HOME=/u01/app/11.2.0/grid)  
  58.   (SID_NAME = +ASM2)  
  59.  )  
  60. )  
  61.  
  62. [oracle@rac1 ~]$ sqlplus sys/123456@192.168.1.41:1521/+ASM as sysdba  
  63. SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 11 21:31:30 2012  
  64. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  65.  
  66. Connected to:  
  67. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production  
  68. With the Real Application Clusters and Automatic Storage Management options  
  69.  
  70. SQL> show parameter name;  
  71.  
  72. NAME                                 TYPE        VALUE  
  73. ------------------------------------ ----------- ------------------------------  
  74. db_unique_name                       string      +ASM  
  75. instance_name                        string      +ASM1  
  76. lock_name_space                      string  
  77. service_names                        string      +ASM  
  78. SQL> conn sys/123456@192.168.1.42:1521/+ASM as sysdba  
  79. Connected.  
  80. SQL> show parameter name;  
  81.  
  82. NAME                                 TYPE        VALUE  
  83. ------------------------------------ ----------- ------------------------------  
  84. db_unique_name                       string      +ASM  
  85. instance_name                        string      +ASM2  
  86. lock_name_space                      string  
  87. service_names                        string      +ASM  
  88.  
  89. [oracle@rac1 admin]$ cat tnsnames.ora //节点2的tnsnames.ora文件做相应的配置  
  90. RAC =  
  91.   (DESCRIPTION =  
  92.     (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))  
  93.     (CONNECT_DATA =  
  94.       (SERVER = DEDICATED)  
  95.       (SERVICE_NAME = rac.yang.com)  
  96.     )  
  97.   )  
  98.  
  99. ASM =  
  100.  (DESCRIPTION =  
  101.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.41)(PORT = 1521))  
  102.     (CONNECT_DATA =  
  103.       (SERVER = DEDICATED)  
  104.       (SERVICE_NAME = +ASM)  
  105.       (SID_NAME = +ASM1)  
  106.     )  
  107.   ) 

二:acfs上安装ogg,acfs用来存放ogg的安装目录,便于集群件的共享,在10g上部署可以选择ocfs2,acfs的部署过程参考:http://ylw6006.blog.51cto.com/470441/925545

 
  1. [root@rac1 ~]# ll -d /vol2/  
  2. drwxrwx--- 4 root asmadmin 4096 Jul  9 09:38 /vol2/  
  3. [root@rac1 ~]# id oracle  
  4. uid=501(oracle) gid=500(oinstall) groups=500(oinstall),502(asmdba),504(dba),505(oper)  
  5. [root@rac1 ~]# chown -R oracle.asmadmin /vol2/  (节点2做同样的操作)  
  6. [root@rac1 ~]# ll -d /vol2/  
  7. drwxrwx--- 4 oracle asmadmin 4096 Jul  9 09:38 /vol2/  
  8.  
  9. [root@rac1 ~]# su - oracle  
  10. [oracle@rac1 ~]$ mkdir -p /vol2/ogg  
  11. [oracle@rac1 ogg]$ tar -xvf /home/oracle/fbo_ggs_Linux_x64_ora11g_64bit.tar   
  12.  
  13. [oracle@rac1 ~]$ grep 'LD_LIBRARY_PATH'  .bash_profile  (节点2做同样的操作)  
  14. export LIBRARY_PATH=/vol2/ogg:$ORACLE_HOME/lib:$LD_LIBRARY_PATH  
  15. [oracle@rac1 ~]$ source .bash_profile   
  16. [oracle@rac1 ~]$ cd -  
  17. /vol2/ogg  
  18. [oracle@rac1 ogg]$ ./ggsci   
  19. Oracle GoldenGate Command Interpreter for Oracle  
  20. Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO  
  21. Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14  
  22.  
  23. Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.  
  24. GGSCI (rac1.yang.com) > create subdirs  
  25.  
  26. Creating subdirectories under current directory /vol2/ogg  
  27.  
  28. Parameter files                /vol2/ogg/dirprm: already exists  
  29. Report files                   /vol2/ogg/dirrpt: created  
  30. Checkpoint files               /vol2/ogg/dirchk: created  
  31. Process status files           /vol2/ogg/dirpcs: created  
  32. SQL script files               /vol2/ogg/dirsql: created  
  33. Database definitions files     /vol2/ogg/dirdef: created  
  34. Extract data files             /vol2/ogg/dirdat: created  
  35. Temporary files                /vol2/ogg/dirtmp: created  
  36. Stdout files                   /vol2/ogg/dirout: created  
  37.  
  38. GGSCI (rac1.yang.com) > view params mgr  
  39. port 7809  
  40. autostart er *  
  41. autorestart er *  
  42.  
  43. GGSCI (rac1.yang.com) > start mgr  
  44. Manager started.  
  45.  
  46. GGSCI (rac1.yang.com) > info mgr  
  47. Manager is running (IP port rac1.yang.com.7809).  
  48.  
  49. GGSCI (rac1.yang.com) > exit  
  50.  
  51. [oracle@rac1 ogg]$ netstat -ntpl |grep 7809  
  52. (Not all processes could be identified, non-owned process info  
  53.  will not be shown, you would have to be root to see it all.)  
  54. tcp        0      0 :::7809                     :::*                        LISTEN      10622/mgr 

三:rac数据库上进行配置,创建用户,授权,运行执行序列号和ddl复制的相关脚本等

 
  1. [oracle@rac1 ogg]$ sqlplus sys/123456@rac as sysdba  
  2. SQL> select instance_name from v$instance;  
  3.  
  4. INSTANCE_NAME  
  5. ----------------  
  6. rac2  
  7.  
  8. SQL> create user ogg identified by ogg;  
  9. User created.  
  10.  
  11. SQL> grant connect,resource,dba to ogg;  
  12. Grant succeeded.  
  13.  
  14. SQL> @sequence.sql   
  15.  
  16. SQL> alter database  add supplemental log data;  
  17. Database altered.  
  18.  
  19. SQL> alter database  add supplemental log data (primary key) columns;  
  20. Database altered.  
  21.  
  22. SQL> alter database  add supplemental log data (foreign key) columns;  
  23. Database altered.  
  24.  
  25. SQL> alter database  add supplemental log data (unique) columns;  
  26. Database altered.  
  27.  
  28. SQL> alter system archive log current;  
  29. System altered.  
  30.  
  31. SQL> grant execute on utl_file to ogg;  
  32. Grant succeeded.  
  33.      
  34. SQL> @marker_setup.sql  
  35. SQL> @ddl_setup.sql  
  36. SQL> @role_setup.sql  
  37. SQL> grant ggs_ggsuser_role to ogg;  
  38. SQL> @ddl_enable.sql  
  39. SQL> @ddl_pin ogg 

四:在source端配置extract group

 
  1. SQL> create user test identified by test;  
  2. User created.  
  3.  
  4. SQL> grant connect,resource to test;  
  5. Grant succeeded.  
  6.  
  7. GGSCI (rac1.yang.com) > dblogin userid ogg,password ogg  
  8. Successfully logged into database.  
  9.  
  10. GGSCI (rac1.yang.com) > add extract testext,tranlog,begin now,threads 2  
  11. EXTRACT added.  
  12.  
  13. GGSCI (rac1.yang.com) > add exttrail /vol2/ogg/dirdat/et, extract testext  
  14. EXTTRAIL added.  
  15.  
  16. GGSCI (rac1.yang.com) > view params testext  
  17. EXTRACT testext  
  18. SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db1")  
  19. USERID ogg@rac, PASSWORD ogg  
  20. TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD 123456  
  21. THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000  
  22. EXTTRAIL /vol2/ogg/dirdat/et  
  23. DYNAMICRESOLUTION  
  24. DDL INCLUDE ALL  
  25. TABLE test.*; 

五:在source端配置data pump extract group

 
  1. GGSCI (rac1.yang.com) > add extract testpump,exttrailsource /vol2/ogg/dirdat/et,begin now  
  2. EXTRACT added.  
  3.  
  4. GGSCI (rac1.yang.com) > add rmttrail /vol2/ogg/dirdat/rt,extract testpump  
  5. RMTTRAIL added.  
  6.  
  7. GGSCI (rac1.yang.com) > view params  testpump  
  8. EXTRACT testpump  
  9. RMTHOST 192.168.1.63, MGRPORT 7809  
  10. RMTTRAIL /vol2/ogg/dirdat/rt  
  11. PASSTHRU  
  12. TABLE test.* 

六:target端配置,这里要保证在tnsnames.ora文件中配置了dg3连接串,同时建立/vol2/ogg/dirdat/rt目录,并授权;在这里未测试过target端和source使用不同的目录是否可行!

 
  1. SQL> create user ogg identified by ogg;  
  2. User created.  
  3.  
  4. SQL> grant connect,resource,dba to ogg;  
  5. Grant succeeded.  
  6.  
  7. SQL> create user test identified by test;  
  8. User created.  
  9.  
  10. SQL> grant connect,resource to test;  
  11. Grant succeeded.  
  12.  
  13. GGSCI (dg3.yang.com) > add replicat testrpt,exttrail /vol2/ogg/dirdat/rt,nodbcheckpoint  
  14. REPLICAT added.  
  15.  
  16. GGSCI (dg3.yang.com) > view params testrpt  
  17. REPLICAT testrpt  
  18. SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db1")  
  19. USERID ogg@dg3,PASSWORD ogg  
  20. ASSUMETARGETDEFS  
  21. HANDLECOLLISIONS  
  22. REPERROR (DEFAULT, DISCARD)  
  23. DDLERROR DEFAULT DISCARD  
  24. DDLOPTIONS REPORT  
  25. DISCARDFILE /vol2/ogg/repsz.dsc,append,megabytes 100  
  26. MAP test.*, TARGET test.*; 

七:启动各进程

 
  1. GGSCI (rac1.yang.com) > start testext  
  2. Sending START request to MANAGER ...  
  3. EXTRACT TESTEXT starting  
  4.  
  5. GGSCI (rac1.yang.com) > start testpump  
  6. Sending START request to MANAGER ...  
  7. EXTRACT TESTPUMP starting  
  8.  
  9. GGSCI (rac1.yang.com) > info all  
  10.  
  11. Program     Status      Group       Lag at Chkpt  Time Since Chkpt  
  12. MANAGER     RUNNING                                             
  13. EXTRACT     RUNNING     TESTEXT     00:00:00      00:19:49      
  14. EXTRACT     RUNNING     TESTPUMP    00:00:00      00:03:24   
  15.  
  16. GGSCI (dg3.yang.com) > start testrpt  
  17. Sending START request to MANAGER ...  
  18. REPLICAT TESTRPT starting  
  19.  
  20. GGSCI (dg3.yang.com) > info all  
  21. Program     Status      Group       Lag at Chkpt  Time Since Chkpt  
  22.  
  23. MANAGER     RUNNING                                             
  24. REPLICAT    RUNNING     TESTRPT     00:00:00      00:00:02   

进程安排在最后启动,在启动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).

八:测试同步情况

 
  1. [oracle@rac1 ~]$ sqlplus test/test@rac   
  2. SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:11:52 2012  
  3. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  4.  
  5. Connected to:  
  6. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production  
  7. With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,  
  8. OLAP, Data Mining, Oracle Database Vault and Real Application Testing options  
  9.  
  10. SQL> create table t1 (id number,name char(10));  
  11. Table created.  
  12.  
  13. SQL> desc t1;  
  14.  Name                                      Null?    Type  
  15.  ----------------------------------------- -------- ----------------------------  
  16.  ID                                                 NUMBER  
  17.  NAME                                               CHAR(10)  
  18.  
  19. SQL> insert into t1 values (1,'one');  
  20. 1 row created.  
  21.  
  22. SQL> commit;  
  23. Commit complete.  
  24.  
  25. SQL> select * from t1;  
  26.  
  27.         ID NAME  
  28. ---------- ----------  
  29.          1 one  
  30.  
  31. [oracle@dg3 ~]$ sqlplus test/test@dg3  
  32. SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:12:31 2012  
  33. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  34.  
  35. Connected to:  
  36. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production  
  37. With the Partitioning, OLAP, Data Mining and Real Application Testing options  
  38.  
  39. SQL> select * from tab;  
  40.  
  41. TNAME                          TABTYPE  CLUSTERID  
  42. ------------------------------ ------- ----------  
  43. T1                             TABLE  
  44.  
  45. SQL> select * from t1;  
  46.  
  47.         ID NAME  
  48. ---------- ----------  
  49.          1 one 

总结: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进程

本文不包含source端的failover功能,后续将继续测试,敬请关注!

参考文章:(感谢作者分享!)
http://www.askmaclean.com/archives/11gr2-rac-add-listener-static-register.html
http://www.rickyzhu.com/2299_goldengate-on-rac.html
http://candon123.blog.51cto.com/704299/556239

本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/932308如需转载请自行联系原作者


ylw6006

相关文章
|
2月前
|
存储 Oracle 关系型数据库
RAC创建ASM磁盘组时配置多路径和UDEV
RAC创建ASM磁盘组时配置多路径和UDEV
117 5
|
9月前
|
Oracle Java 关系型数据库
RAC 环境中 gc block lost 和私网通信性能问题的诊断
对于每个节点,以及集群汇总统计信息中的global cache数据块丢失的统计信息("gc cr block lost" 和/或 "gc current block lost") 代表了私网通信的包处理效率低或者包的处理存在异常。
200 0
|
12月前
|
存储 Oracle 关系型数据库
|
Oracle 关系型数据库 Linux
Oracle RAC:多路径配置Centos操作系统
Centos操作系统多路径配置
471 0
|
Oracle 关系型数据库
Oracle RAC在RHEL7多路径配置,超实用
Oracle RAC在RHEL7多路径配置,超实用
463 0
Oracle RAC在RHEL7多路径配置,超实用
|
Oracle 网络协议 关系型数据库