centos: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

我们采用静态注册方法将webdb服务注册到监听器中,$Oracle_HOME/network/admin/listener.ora中的内容设置如下:

  1. SID_LIST_LISTENER =
  2. (SID_LIST =
  3. (SID_DESC =
  4. (SID_NAME = PLSExtProc)
  5. (ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
  6. (PROGRAM = extproc)
  7. )
  8. (SID_DESC =
  9. (SID_NAME = webdb)
  10. (ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
  11. )
  12. )
  13. LISTENER =
  14. (DESCRIPTION_LIST =
  15. (DESCRIPTION =
  16. (ADDRESS = (PROTOCOL = TCP)(HOST = serv1)(PORT = 1844))
  17. (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
  18. )
  19. )

其中这几行文字是为了静态注册webdb而加入的,如下:

  1. (SID_DESC =
  2. (SID_NAME = webdb)
  3. (ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
  4. )

监听器的服务状况一直是UNKNOWN,不管注册使用的数据库实例是否打开。如下所示:

  1. oratt@serv1:/home/oratt=>webdb$lsnrctl services
  2. LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 07-NOV-201213:37:56
  3. Copyright (c) 19912007, Oracle. All rights reserved.
  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=serv1)(PORT=1844)))
  5. Services Summary...
  6. Service "PLSExtProc" has 1 instance(s).
  7. Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
  8. Handler(s):
  9. "DEDICATED" established:0 refused:0
  10. LOCAL SERVER
  11. Service "webdb" has 1 instance(s).
  12. Instance "webdb", status UNKNOWN, has 1 handler(s) for this service...
  13. Handler(s):
  14. "DEDICATED" established:3 refused:0
  15. LOCAL SERVER
  16. The command completed successfully

因为这个监听器的端口号不是1521(默认注册),所以采用必须的得采用下面的动态注册方法

动态注册方法 如下所示:

$sqlplus / as sysdba

SQL>alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.15.90)(PORT=1844))))';

 或者

SQL> alter system set LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.15.90)(PORT=1844))' scope=both;
SQL> alter system register;

修改之后,使用lsnrctl services检查监听器的服务状况,会发现有webdb注册进来,其状态是ready。发现该服务已经注册到监听器。

  1. oratt@serv2:/home/oratt=>webdb$lsnrctl services
  2. LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 07-NOV-201213:55:38
  3. Copyright (c) 19912007, Oracle. All rights reserved.
  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=serv2)(PORT=1844)))
  5. Services Summary...
  6. Service "PLSExtProc" has 1 instance(s).
  7. Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
  8. Handler(s):
  9. "DEDICATED" established:0 refused:0
  10. LOCAL SERVER
  11. Service "webdb" has 1 instance(s).
  12. Instance "webdb", 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 "webdb_XPT" has 1 instance(s).
  17. Instance "webdb", status READY, has 1 handler(s) for this service...
  18. Handler(s):
  19. "DEDICATED" established:0 refused:0 state:ready
  20. LOCAL SERVER
  21. The command completed successfully
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值