您的位置:首页 > 运维架构 > Linux

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

2014-08-21 00:28 489 查看
我们采用静态注册方法将webdb服务注册到监听器中,$Oracle_HOME/network/admin/listener.ora中的内容设置如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = webdb)
(ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = serv1)(PORT = 1844))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

其中这几行文字是为了静态注册webdb而加入的,如下:
(SID_DESC =
(SID_NAME = webdb)
(ORACLE_HOME = /u01/app/oratt/product/10.2.0/dbhome_1)
)

监听器的服务状况一直是UNKNOWN,不管注册使用的数据库实例是否打开。如下所示:
oratt@serv1:/home/oratt=>webdb$lsnrctl services
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 07-NOV-201213:37:56
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=serv1)(PORT=1844)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "webdb" has 1 instance(s).
Instance "webdb", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0
LOCAL SERVER
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。发现该服务已经注册到监听器。
oratt@serv2:/home/oratt=>webdb$lsnrctl services
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 07-NOV-201213:55:38
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=serv2)(PORT=1844)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "webdb" has 1 instance(s).
Instance "webdb", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "webdb_XPT" has 1 instance(s).
Instance "webdb", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle
相关文章推荐