ITPub博客

首页 > 数据库 > Oracle > OGG搭建(rac到-->单实例)

OGG搭建(rac到-->单实例)

Oracle 作者:quanshengaa 时间:2016-06-17 10:19:29 0 删除 编辑
开启归档。
在两个节点分别创建本地目录/arch1

点击(此处)折叠或打开

  1. SQL> alter system set log_archive_dest_1 ='location=/arch1' scope=both sid='*';

  2. System altered.

  3. SQL> archive log lsit
  4. SP2-0718: illegal ARCHIVE LOG option
  5. SQL> archive log list
  6. Database log mode     No Archive Mode
  7. Automatic archival     Disabled
  8. Archive destination     /arch1
  9. Oldest online log sequence 32
  10. Current log sequence     34
两个节点都启动到mount状态然后,alter database archivelog; 执行完之后两个节点再open,你懂得否则报错:

点击(此处)折叠或打开

  1. SQL> alter database archivelog;
  2. alter database archivelog
  3. *
  4. ERROR at line 1:
  5. ORA-01126: database must be mounted in this instance and not open in any
  6. instance
因为我们在节点1配置ogg所以得配置NFS,让节点1看到节点2的归档。
在节点2上 /etc/exports添加如下内容:

点击(此处)折叠或打开

  1. /arch1 *(ro)
然后启动NFS

点击(此处)折叠或打开

  1. [root@rac2 ~]# service nfs start
  2. Starting NFS services:           [ OK ]
  3. Starting NFS quotas:             [ OK ]
  4. Starting NFS daemon:             [ OK ]
  5. Starting NFS mountd:             [ OK ]
在节点1上

点击(此处)折叠或打开

  1. [root@rac1 ~]# mkdir /arch2
  2. [root@rac1 ~]# chown -R oracle:oinstall /arch2
  3. [root@rac1 ~]# mount -t nfs 10.10.10.2:/arch1 /arch2 -o nolock
  4. [root@rac1 ~]# cd /arch2
  5. [root@rac1 arch2]# ls
  6. 1_34_876782166.dbf
添加NFS自启


配置ASM动态注册
Oracle 11g RAC的监听是用grid用户来管理的,所以用grid用户来操作。

点击(此处)折叠或打开

  1. [root@rac1 ~]# su - grid
  2. [grid@rac1 ~]$ srvctl status listener
  3. Listener LISTENER is enabled
  4. Listener LISTENER is running on node(s): rac2,rac1
  5. [grid@rac1 ~]$ lsnrctl status

  6. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-SEP-2015 17:07:10

  7. Copyright (c) 1991, 2011, Oracle. All rights reserved.

  8. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
  9. STATUS of the LISTENER
  10. ------------------------
  11. Alias LISTENER
  12. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  13. Start Date 28-SEP-2015 16:30:33
  14. Uptime 0 days 0 hr. 36 min. 36 sec
  15. Trace Level off
  16. Security ON: Local OS Authentication
  17. SNMP OFF
  18. Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
  19. Listener Log File /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
  20. Listening Endpoints Summary...
  21.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  22.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.101)(PORT=1521)))
  23.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.103)(PORT=1521)))
  24. Services Summary...
  25. Service "+ASM" has 1 instance(s).
  26.   Instance "+ASM1", status READY, has 1 handler(s) for this service...
  27. Service "prod" has 2 instance(s).
  28.   Instance "prod1", status READY, has 2 handler(s) for this service...
  29.   Instance "prod2", status READY, has 1 handler(s) for this service...
  30. Service "prodXDB" has 2 instance(s).
  31.   Instance "prod1", status READY, has 1 handler(s) for this service...
  32.   Instance "prod2", status READY, has 1 handler(s) for this service...
  33. The command completed successfully


点击(此处)折叠或打开

  1. SID_LIST_LISTENER =
  2.   (SID_LIST =
  3.     (SID_DESC =
  4.       (GLOBAL_DBNAME = ASM)
  5.       (ORACLE_HOME = /u01/11.2.0/grid)
  6.       (SID_NAME = +ASM1)
  7.     )
  8.   )

点击(此处)折叠或打开

  1. [grid@rac1 ~]$ lsnrctl status

  2. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-SEP-2015 17:07:10

  3. Copyright (c) 1991, 2011, Oracle. All rights reserved.

  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
  5. STATUS of the LISTENER
  6. ------------------------
  7. Alias LISTENER
  8. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  9. Start Date 28-SEP-2015 16:30:33
  10. Uptime 0 days 0 hr. 36 min. 36 sec
  11. Trace Level off
  12. Security ON: Local OS Authentication
  13. SNMP OFF
  14. Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
  15. Listener Log File /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
  16. Listening Endpoints Summary...
  17.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  18.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.101)(PORT=1521)))
  19.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.103)(PORT=1521)))
  20. Services Summary...
  21. Service "+ASM" has 1 instance(s).
  22.   Instance "+ASM1", status READY, has 1 handler(s) for this service...
  23. Service "prod" has 2 instance(s).
  24.   Instance "prod1", status READY, has 2 handler(s) for this service...
  25.   Instance "prod2", status READY, has 1 handler(s) for this service...
  26. Service "prodXDB" has 2 instance(s).
  27.   Instance "prod1", status READY, has 1 handler(s) for this service...
  28.   Instance "prod2", status READY, has 1 handler(s) for this service...
  29. The command completed successfully
  30. [grid@rac1 ~]$ echo $ORACLE_HOME
  31. /u01/11.2.0/grid
  32. [grid@rac1 home]$ cd $ORACLE_HOME
  33. [grid@rac1 grid]$ ls
  34. assistants crf dbs evm install jlib mdns ologgerd osysmond racg slax wwg
  35. auth crs dc_ocm gipc instantclient JRE mesg OPatch oui rdbms sqlplus xdk
  36. bin csmig deinstall gns inventory ldap network opmn owm relnotes srvm
  37. cdata css demo gpnp javavm lib nls oracore perl root.sh sysman
  38. cfgtoollogs ctss diagnostics has jdbc log oc4j oraInst.loc plsql rootupgrade.sh usm
  39. clone cv eons hs jdk md ohasd ord precomp scheduler utl
  40. [grid@rac1 grid]$ pwd
  41. /u01/11.2.0/grid
  42. [grid@rac1 grid]$ cd network/admin
  43. [grid@rac1 admin]$ ll
  44. total 72
  45. -rw-r--r-- 1 grid oinstall 182 Apr 8 19:34 endpoints_listener.ora
  46. -rw-r--r-- 1 grid oinstall 184 Apr 8 19:34 listener1504087PM3409.bak
  47. -rw-r--r-- 1 grid oinstall 350 May 20 12:04 listener15052012PM0404.bak
  48. -rw-r--r-- 1 grid oinstall 350 Apr 8 19:34 listener.ora
  49. -rw-r--r-- 1 grid oinstall 184 Apr 8 19:20 listener.ora.bak.rac1
  50. drwxr-xr-x 2 grid oinstall 4096 Apr 8 18:44 samples
  51. -rw-r--r-- 1 grid oinstall 205 May 11 2011 shrept.lst
  52. -rw-r--r-- 1 grid oinstall 210 May 20 12:04 sqlnet15052012PM0404.bak
  53. -rw-r--r-- 1 grid oinstall 210 Apr 8 19:34 sqlnet.ora
  54. [grid@rac1 admin]$ cat listener.ora
  55. LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))        # line added by Agent
  56. LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))        # line added by Agent
  57. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON        # line added by Agent
  58. ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON        # line added by Agent
  59. [grid@rac1 admin]$ vim listener.ora
  60. [grid@rac1 admin]$
  61. [grid@rac1 admin]$ lsnrctl reload

  62. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-SEP-2015 17:25:09

  63. Copyright (c) 1991, 2011, Oracle. All rights reserved.

  64. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
  65. The command completed successfully
  66. [grid@rac1 admin]$ lsnrctl status

  67. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-SEP-2015 17:25:12

  68. Copyright (c) 1991, 2011, Oracle. All rights reserved.

  69. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
  70. STATUS of the LISTENER
  71. ------------------------
  72. Alias LISTENER
  73. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  74. Start Date 28-SEP-2015 16:30:33
  75. Uptime 0 days 0 hr. 54 min. 39 sec
  76. Trace Level off
  77. Security ON: Local OS Authentication
  78. SNMP OFF
  79. Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
  80. Listener Log File /u01/app/oracle/diag/tnslsnr/rac1/listener/alert/log.xml
  81. Listening Endpoints Summary...
  82.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  83. Services Summary...
  84. Service "ASM" has 1 instance(s).
  85.   Instance "+ASM1", status UNKNOWN, has 1 handler(s) for this service...
  86. The command completed successfully
节点而一样

点击(此处)折叠或打开

  1. SID_LIST_LISTENER =
  2.   (SID_LIST =
  3.     (SID_DESC =
  4.       (GLOBAL_DBNAME = ASM)
  5.       (ORACLE_HOME = /u01/11.2.0/grid)
  6.       (SID_NAME = +ASM2)
  7.     )
  8.   )




配置TNS文件

点击(此处)折叠或打开

  1. RAC_11G =
  2.    (DESCRIPTION =
  3.      (ADDRESS_LIST =
  4.        (LOAD_BALANCE = yes)
  5.        (FAILOVER = ON)
  6.        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.103)(PORT = 1521))
  7.        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.104)(PORT = 1521))
  8.      )
  9.      (CONNECT_DATA =
  10.       (SERVICE_NAME = prod)
  11.       (failover_mode=(type=select)(mothod=basic))
  12.      )
  13.    )

  14. ASM =
  15.    (DESCRIPTION =
  16.      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.103)(PORT = 1521))
  17.      (CONNECT_DATA =
  18.       (SERVCE = DEDICATED)
  19.       (SERVICE_NAME = ASM)
  20.       (INSTANCE_NAME = +ASM1)
  21.       (UR = A)
  22.      )
  23.    )
注意这里连接ASM的配置中必须添加(UR = A),该参数表示允许远程调用,这个必须有,否则ASM实例不能连接。





安装ogg软件




继续... ...

安装完成后将数据库配置成归档,强制日志,附加日志。

点击(此处)折叠或打开

  1. SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;

  2. LOG_MODE SUPPLEME FOR
  3. ------------ -------- ---
  4. ARCHIVELOG NO NO

  5. SQL> alter database force logging;

  6. Database altered.

  7. SQL> alter database add supplemental log data;

  8. Database altered.

  9. SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;

  10. LOG_MODE SUPPLEME FOR
  11. ------------ -------- ---
  12. ARCHIVELOG YES YES
创建ogg单独的表空间及用户这是12c必须做的。

点击(此处)折叠或打开

  1. SQL> create tablespace ggs datafile '+DATA_MORMAL' size 100M autoextend on;

  2. Tablespace created.

  3. SQL> create user ggs identified by ggs default tablespace ggs temporary tablespace temp;

  4. User created.

  5. SQL> grant connect ,resource to ggs;

  6. Grant succeeded.

  7. SQL> grant execute on utl_file to ggs;

  8. Grant succeeded.



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15797451/viewspace-2120333/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-08

  • 博文量
    51
  • 访问量
    125608