【发布时间】:2016-01-07 21:31:58
【问题描述】:
我知道这是一个非常流行的问题,我之前也遇到过几次,但都能解决,但这次不行。
我通过运行确保我使用了正确的服务名称
SQL> select value from v$parameter where name='service_names';
VALUE
--------------------------------------------------------------------------------
XE
我的 tnsnames.ora 有 XE 服务名称:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
当我启动监听器时,它似乎可以识别服务: [root@aa-axm admin]# lsnrctl start
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 09-OCT-2015 12:58:28
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)) (SERVICE_NAME=XE))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Connecting to (DESCRIPTION=(SERVICE_NAME=XE)(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 09-OCT-2015 12:58:28
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))(SERVICE_NAME=XE))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
然而,我仍然遇到那个该死的错误
[root@aa-axm admin]# sqlplus SYSTEM/**********@XE
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 9 12:58:36 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
我错过了什么? TIA
【问题讨论】:
-
你的数据库的
local_listenerinit 参数设置了吗? You might be having this problem。 (不是很相关,但你为什么要以 root 身份执行此操作?) -
您引用的 tnsnames.ora 文件的位置是什么?您是否尝试从同一台机器连接到数据库?
-
tnsnames.ora 位于 $ORACLE_HOME/network/admin,其中 ORACLE_HOME/u01/app/oracle/product/11.2.0/xe/network/admin。是的,我正在尝试从同一台机器进行连接。
-
您的
local_listener设置呢?如果为空,aa-axm是否解析为 127.0.0.1 或其他?如果您只想在本地连接,请更改local_listener(如链接答案中所示);否则更改侦听器所在的地址。无论哪种方式,它们都需要匹配。 -
我使用 localhost alter system set local_listener = '(address=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope=memory;