2019-02-14 19:56 by AlfredZhao, 阅读, 评论, 收藏, 编辑

当数据库在nomount,mount或者restricted这类特殊状态下,同时动态监听显示状态为BLOCKED,客户端无法直接连接到实例,此时可通过配置UR=A进行连接。最常见的场景就是10g版本的RAC,配置OGG时需要访问ASM实例的情况(实测11.2版本的RAC ASM实例动态监听的显示状态为Ready,无需添加UR=A配置即可连接)。下面是测试过程:

环境:Oracle 10.2.0.5 RAC + ASM
tnsnames.ora配置如下:

  1. ASM =
  2. (DESCRIPTION =
  3. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521))
  4. (CONNECT_DATA =
  5. (SERVER = DEDICATED)
  6. (SERVICE_NAME = +ASM)
  7. (INSTANCE_NAME = +ASM1)
  8. )

监听状态如下:

  1. [oracle@rac1-server admin]$ lsnrctl status
  2. LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 14-FEB-2019 19:37:22
  3. Copyright (c) 1991, 2010, Oracle. All rights reserved.
  4. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  5. STATUS of the LISTENER
  6. ------------------------
  7. Alias LISTENER_RAC1-SERVER
  8. Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production
  9. Start Date 12-FEB-2019 12:59:06
  10. Uptime 2 days 6 hr. 38 min. 15 sec
  11. Trace Level off
  12. Security ON: Local OS Authentication
  13. SNMP OFF
  14. Listener Parameter File /s01/oracle/product/10.2.0/db_1/network/admin/listener.ora
  15. Listener Log File /s01/oracle/product/10.2.0/db_1/network/log/listener_rac1-server.log
  16. Listening Endpoints Summary...
  17. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.172)(PORT=1521)))
  18. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.171)(PORT=1521)))
  19. Services Summary...
  20. Service "+ASM" has 1 instance(s).
  21. Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
  22. Service "+ASM_XPT" has 1 instance(s).
  23. Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
  24. Service "PLSExtProc" has 1 instance(s).
  25. Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
  26. Service "SYS$SYS.KUPC$S_1_20170912101328.JY.ORACLE.COM" has 1 instance(s).
  27. Instance "jy2", status READY, has 1 handler(s) for this service...
  28. Service "jy.oracle.com" has 1 instance(s).
  29. Instance "jy2", status READY, has 1 handler(s) for this service...
  30. Service "jyXDB.oracle.com" has 1 instance(s).
  31. Instance "jy2", status READY, has 1 handler(s) for this service...
  32. Service "jy_XPT.oracle.com" has 1 instance(s).
  33. Instance "jy2", status READY, has 1 handler(s) for this service...
  34. Service "orcl" has 2 instance(s).
  35. Instance "orcl1", status READY, has 2 handler(s) for this service...
  36. Instance "orcl2", status READY, has 1 handler(s) for this service...
  37. Service "orclXDB" has 2 instance(s).
  38. Instance "orcl1", status READY, has 1 handler(s) for this service...
  39. Instance "orcl2", status READY, has 1 handler(s) for this service...
  40. Service "orcl_XPT" has 2 instance(s).
  41. Instance "orcl1", status READY, has 2 handler(s) for this service...
  42. Instance "orcl2", status READY, has 1 handler(s) for this service...
  43. The command completed successfully
  44. [oracle@rac1-server admin]$

此时如果通过网络连接ASM实例,会报错ORA-12528:

  1. [oracle@rac1-server admin]$ sqlplus sys/oracle@asm as sysdba
  2. SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 14 19:25:52 2019
  3. Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
  4. ERROR:
  5. ORA-12528: TNS:listener: all appropriate instances are blocking new connections
  6. Enter user-name:

修改tnsnames.ora,增加UR=A配置:

  1. ASM =
  2. (DESCRIPTION =
  3. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521))
  4. (CONNECT_DATA =
  5. (UR=A)
  6. (SERVER = DEDICATED)
  7. (SERVICE_NAME = +ASM)
  8. (INSTANCE_NAME = +ASM1)
  9. )

再次尝试通过网络连接ASM实例,可成功连接:

  1. [oracle@rac1-server admin]$ sqlplus sys/oracle@asm as sysdba
  2. SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 14 19:26:26 2019
  3. Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
  4. Connected to:
  5. Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
  6. With the Partitioning, Real Application Clusters, OLAP, Data Mining
  7. and Real Application Testing options
  8. SQL>

环境:Oracle 11.2.0.4 RAC + ASM
tnsnames.ora配置如下:

  1. ASM =
  2. (DESCRIPTION =
  3. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.107)(PORT = 1522))
  4. (CONNECT_DATA =
  5. (SERVER = DEDICATED)
  6. (SERVICE_NAME = +ASM)
  7. (INSTANCE_NAME = +ASM1)
  8. )
  9. )

监听状态如下:

  1. [grid@db01 admin]$ lsnrctl status
  2. LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-FEB-2019 19:41:59
  3. Copyright (c) 1991, 2013, 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.4.0 - Production
  9. Start Date 13-FEB-2019 11:28:44
  10. Uptime 1 days 8 hr. 13 min. 14 sec
  11. Trace Level off
  12. Security ON: Local OS Authentication
  13. SNMP OFF
  14. Listener Parameter File /opt/app/11.2.0/grid/network/admin/listener.ora
  15. Listener Log File /opt/app/grid/diag/tnslsnr/db01/listener/alert/log.xml
  16. Listening Endpoints Summary...
  17. (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  18. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.107)(PORT=1522)))
  19. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.117)(PORT=1522)))
  20. Services Summary...
  21. Service "+ASM" has 1 instance(s).
  22. Instance "+ASM1", status READY, has 1 handler(s) for this service...
  23. Service "A" has 1 instance(s).
  24. Instance "orcl1", status READY, has 1 handler(s) for this service...
  25. Service "B" has 1 instance(s).
  26. Instance "orcl1", status READY, has 1 handler(s) for this service...
  27. Service "orcl" has 1 instance(s).
  28. Instance "orcl1", status READY, has 1 handler(s) for this service...
  29. Service "orclXDB" has 1 instance(s).
  30. Instance "orcl1", status READY, has 1 handler(s) for this service...
  31. The command completed successfully
  32. [grid@db01 admin]$

在没有配置UR=A的情况下,就可以正常连接到ASM实例:

  1. --没有指定as sysasm会报错ORA-15000
  2. [oracle@db01 admin]$ sqlplus sys/oracle@asm
  3. SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 14 19:23:57 2019
  4. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  5. ERROR:
  6. ORA-15000: command disallowed by current instance type
  7. Enter user-name: ^C
  8. --指定后就可以正常连接:
  9. [oracle@db01 admin]$ sqlplus sys/oracle@asm as sysasm
  10. SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 14 19:24:00 2019
  11. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  12. Connected to:
  13. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  14. With the Real Application Clusters and Automatic Storage Management options
  15. SQL>

由此验证了11.2.0.4环境下,通过网络连接ASM实例,不再需要UR=A的配置。

版权声明:本文为jyzhao原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/jyzhao/p/10376660.html