【问题标题】:ORA-12514 TNS:listener does not currently know of service requested in connect descriptor for existing serviceORA-12514 TNS: 侦听器当前不知道现有服务的连接描述符中请求的服务
【发布时间】: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_listener init 参数设置了吗? 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;

标签: oracle oracle11g tnsnames


【解决方案1】:

我终于解决了

alter system set local_listener='XE' scope=both;
alter system register;

感谢Alex Poole 让我走上了正确的道路。

【讨论】:

  • 非常感谢,我花了好几个小时才找到答案。
猜你喜欢
  • 2012-06-02
  • 1970-01-01
  • 2015-06-15
  • 1970-01-01
  • 2018-07-16
  • 2023-03-05
相关资源
最近更新 更多