ORA-12514 TNS:listener does not currently know of

2019-08-08 03:57发布

问题:

I know that this is a pretty popular problem, and I had run into it several times before but were able to resolve it but not this time.

I had made sure that I'm using the correct service name by running

SQL> select value from v$parameter where name='service_names';

VALUE
--------------------------------------------------------------------------------
XE

My tnsnames.ora has the XE service name:

XE =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = XE)
     )
   )

When I start the listener, it appear to recognize the service: [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

And yet, I'm still getting that blasted error

[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

What am I missing? TIA

回答1:

I had it finally resolved by doing

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

thanks to Alex Poole for setting me on the right path.