非默认监听注册问题

在集群环境或非集群环境中,local_listener或remote_listener参数设置错误,可能导致数据库就不能启动,报ORA-00119和ORA-00132错误。


官方文档Oracle Database Net Services Administrator's Guide (11.2)第9章Configuring and Administering Oracle Net Listener中的相关解释为

Configuring a Naming Method

The listener name alias specified for the LOCAL_LISTENER initialization parameter, REMOTE_LISTENER initialization parameter, or LISTENER attribute can be resolved through a tnsnames.ora file. A net service name entry can be created for the protocol address without the CONNECT_DATA section of the connect descriptor. Oracle Enterprise Manager and Oracle Net Manager cannot configure a tnsnames.ora file without the CONNECT_DATA information. To use listener name aliases, Oracle recommends you modify the tnsnames.ora file using a text editor.

For example, if LOCAL_LISTENER is set to listener_sales1 and listener_sales1 uses TCP/IP on port 1421, then the entry in the tnsnames.ora file would be:

listener_sales1=

(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1421))


Notes:

■ Multiple addresses are supported, but connect-time failover and client load balancing features are not supported.

■ If the listener alias specified in the LOCAL_LISTENER parameter is invalid or not resolved, then the PMON process does not allow the database to start. The following


errors occur:

ORA-00119: invalid specification for system parameter LOCAL_LISTENER

ORA-00132: syntax error or unresolved network name ’%s


注册非默认监听方法


When configuring the listener to listen on TCP/IP, you should enter the default port of 1521. If you do not, you must configure the LOCAL_LISTENER parameter in the intialization parameter file and resolve the listener name through a naming method.


网上有个实验文章 http://blog.csdn.net/t0nsha/article/details/6630348

(1)新增两个测试的监听,listener.ora的配置内容(可纯手动编辑该文件或使用netca)如下:

(LISTENER为系统原有;L1、L2为测试用新增的监听)

  1. # listener.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  2. # Generated by Oracle configuration tools.  

  3. L2 =  

  4.  (DESCRIPTION_LIST =  

  5.    (DESCRIPTION =  

  6.      (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1523))  

  7.    )  

  8.  )  

  9. L1 =  

  10.  (DESCRIPTION_LIST =  

  11.    (DESCRIPTION =  

  12.      (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1522))  

  13.    )  

  14.  )  

  15. SID_LIST_LISTENER =  

  16.  (SID_LIST =  

  17.    (SID_DESC =  

  18.      (SID_NAME = PLSExtProc)  

  19.      (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)  

  20.      (PROGRAM = extproc)  

  21.    )  

  22.  )  

  23. LISTENER =  

  24.  (DESCRIPTION_LIST =  

  25.    (DESCRIPTION =  

  26.      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))  

  27.      (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1521))  

  28.    )  

  29.  )  


(2)配置tnsnames.ora,使数据库(t02)可同时使用以上3个监听:

  1. # tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora  

  2. # Generated by Oracle configuration tools.  

  3. T01 =  

  4.  (DESCRIPTION =  

  5.    (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1521))  

  6.    (CONNECT_DATA =  

  7.      (SERVER = DEDICATED)  

  8.      (SERVICE_NAME = t01)  

  9.    )  

  10.  )  

  11. T02 =  

  12.  (DESCRIPTION =  

  13.    (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1521))  

  14.    (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1522))  

  15.    (ADDRESS = (PROTOCOL = TCP)(HOST = PC1255-20110528)(PORT = 1523))  

  16.    (CONNECT_DATA =  

  17.      (SERVER = DEDICATED)  

  18.      (SERVICE_NAME = t02)  

  19.    )  

  20.  )  

  21. EXTPROC_CONNECTION_DATA =  

  22.  (DESCRIPTION =  

  23.    (ADDRESS_LIST =  

  24.      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))  

  25.    )  

  26.    (CONNECT_DATA =  

  27.      (SID = PLSExtProc)  

  28.      (PRESENTATION = RO)  

  29.    )  

  30.  )  


(3)检查及测试,发现问题:

检查的时候发现除了默认的LISTENER监听外,L1和L2始终不能注册服务:

  1. C:\>lsnrctl  

  2. LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-7月 -2011 22:19:24  

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

  4. 欢迎来到LSNRCTL, 请键入"help"以获得信息。  

  5. LSNRCTL> status  

  6. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))  

  7. LISTENER 的 STATUS  

  8. ------------------------

  9. 别名                      LISTENER  

  10. 版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production  

  11. 启动日期                  24-7月 -2011 22:14:18  

  12. 正常运行时间              0 天 0 小时 5 分 13 秒  

  13. 跟踪级别                  off

  14. 安全性                    ON: Local OS Authentication  

  15. SNMP                      OFF

  16. 监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  17. 监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\listener.log  

  18. 监听端点概要...  

  19.  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))  

  20.  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1521)))  

  21. 服务摘要..  

  22. 服务 "+ASM_XPT" 包含 1 个例程。  

  23.  例程 "+asm", 状态 BLOCKED, 包含此服务的 1 个处理程序...  

  24. 服务 "+asm" 包含 1 个例程。  

  25.  例程 "+asm", 状态 BLOCKED, 包含此服务的 1 个处理程序...  

  26. 服务 "PLSExtProc" 包含 1 个例程。  

  27.  例程 "PLSExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...  

  28. 服务 "t01" 包含 1 个例程。  

  29.  例程 "t01", 状态 READY, 包含此服务的 1 个处理程序...  

  30. 服务 "t01XDB" 包含 1 个例程。  

  31.  例程 "t01", 状态 READY, 包含此服务的 1 个处理程序...  

  32. 服务 "t01_XPT" 包含 1 个例程。  

  33.  例程 "t01", 状态 READY, 包含此服务的 1 个处理程序...  

  34. 命令执行成功  

  35. LSNRCTL> stop  

  36. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))  

  37. 命令执行成功  

  38. LSNRCTL> set curr L1  

  39. 目前的监听程序为 L1  

  40. LSNRCTL> status  

  41. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))  

  42. LISTENER 的 STATUS  

  43. ------------------------

  44. 别名                      L1  

  45. 版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production  

  46. 启动日期                  24-7月 -2011 22:14:19  

  47. 正常运行时间              0 天 0 小时 5 分 26 秒  

  48. 跟踪级别                  off

  49. 安全性                    ON: Local OS Authentication  

  50. SNMP                      OFF

  51. 监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  52. 监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l1.log  

  53. 监听端点概要...  

  54.  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1522)))  

  55. 监听程序不支持服务  

  56. 命令执行成功  

  57. LSNRCTL> set curr L2  

  58. 目前的监听程序为 L2  

  59. LSNRCTL> status  

  60. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1523)))  

  61. LISTENER 的 STATUS  

  62. ------------------------

  63. 别名                      L2  

  64. 版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production  

  65. 启动日期                  24-7月 -2011 22:14:19  

  66. 正常运行时间              0 天 0 小时 5 分 38 秒  

  67. 跟踪级别                  off

  68. 安全性                    ON: Local OS Authentication  

  69. SNMP                      OFF

  70. 监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  71. 监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l2.log  

  72. 监听端点概要...  

  73.  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1523)))  

  74. 监听程序不支持服务  

  75. 命令执行成功  


停止了默认的LISTENER监听后,使用tns进行连接测试的时候报错(ORA-12514):

  1. C:\Documents and Settings\Administrator>sqlplus scott/tiger@t02  

  2. SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 7月 24 22:20:06 2011  

  3. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  

  4. ERROR:  

  5. ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务  


(4)分析问题:

一阵google之后发现,如果默认端口不是1521,则需要设置LOCAL_LISTENER来手动指定监听别名:

When configuring the listener to listen on TCP/IP, you should enter the default port of 1521. If you do not, you must configure the LOCAL_LISTENER parameter in the intialization parameter file and resolve the listener name through a naming method.

http://download.oracle.com/docs/cd/B13789_01/network.101/b10775/listenercfg.htm

(5)解决问题(此处的T02为step 2的tnsnames.ora里面的T02):

  1. C:\Documents and Settings\Administrator>set oracle_sid=t02  

  2. C:\Documents and Settings\Administrator>sqlplus / as sysdba  

  3. SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 7月 24 22:21:55 2011  

  4. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  

  5. 已连接到空闲例程。  

  6. SQL> select status,instance_name from v$instance;  

  7. STATUS                   INSTANCE_NAME  

  8. ------------------------ --------------------------------

  9. OPEN                     t02  

  10. SQL> alter system set local_listener="T02";  

  11. 系统已更改。  

  12. SQL>  


(6)验证,再测试:

验证,发现L1、L2已能正常注册服务:

  1. LSNRCTL> set curr L1  

  2. 目前的监听程序为 L1  

  3. LSNRCTL> status  

  4. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1522)))  

  5. LISTENER 的 STATUS  

  6. ------------------------

  7. 别名                      L1  

  8. 版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production  

  9. 启动日期                  24-7月 -2011 22:14:19  

  10. 正常运行时间              0 天 0 小时 32 分 54 秒  

  11. 跟踪级别                  off

  12. 安全性                    ON: Local OS Authentication  

  13. SNMP                      OFF

  14. 监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  15. 监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l1.log  

  16. 监听端点概要...  

  17.  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1522)))  

  18. 服务摘要..  

  19. 服务 "t02" 包含 1 个例程。  

  20.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  21. 服务 "t02XDB" 包含 1 个例程。  

  22.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  23. 服务 "t02_XPT" 包含 1 个例程。  

  24.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  25. 命令执行成功  

  26. LSNRCTL> set curr L2  

  27. 目前的监听程序为 L2  

  28. LSNRCTL> status  

  29. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=PC1255-20110528)(PORT=1523)))  

  30. LISTENER 的 STATUS  

  31. ------------------------

  32. 别名                      L2  

  33. 版本                      TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production  

  34. 启动日期                  24-7月 -2011 22:14:19  

  35. 正常运行时间              0 天 0 小时 33 分 6 秒  

  36. 跟踪级别                  off

  37. 安全性                    ON: Local OS Authentication  

  38. SNMP                      OFF

  39. 监听程序参数文件          D:\oracle\product\10.2.0\db_1\network\admin\listener.ora  

  40. 监听程序日志文件          D:\oracle\product\10.2.0\db_1\network\log\l2.log  

  41. 监听端点概要...  

  42.  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PC1255-20110528)(PORT=1523)))  

  43. 服务摘要..  

  44. 服务 "t02" 包含 1 个例程。  

  45.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  46. 服务 "t02XDB" 包含 1 个例程。  

  47.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  48. 服务 "t02_XPT" 包含 1 个例程。  

  49.  例程 "t02", 状态 READY, 包含此服务的 1 个处理程序...  

  50. 命令执行成功  

  51. LSNRCTL>  


再测试,发现scott用户能够正常登录:

  1. C:\Documents and Settings\Administrator>sqlplus scott/tiger@t02  

  2. SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 7月 24 22:24:43 2011  

  3. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  

  4. 连接到:  

  5. Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production  

  6. With the Partitioning, OLAP and Data Mining options  

  7. SQL>  

(7)总结

当监听的端口是默认的1521时,PMON会动态注册该监听(listener);

当监听的端口不是默认的1521时,需要使用alter system set local_listener="T02";来手动注册监听。

配置的监听在lisnrctl.ora文档和tnsname.ora文档中都要写上


本文出自 “无双城” 博客,请务必保留此出处http://929044991.blog.51cto.com/1758347/1281015

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值