ORA 12514 error:TNS listener error

2020-07-22 17:10发布

问题:

Ok everything worked fine till yesterday now i am suddenly getting this error
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
nothing had been modified

XE =
  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = jainam-2b1c493d)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
        (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

  ORACLR_CONNECTION_DATA = 
      (DESCRIPTION = 
     (ADDRESS_LIST = 
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
     (CONNECT_DATA = 
   (SID = CLRExtProc) 
   (PRESENTATION = RO) 
 ) 
) 


I am totally stuck and have no idea what to do. I tried help from here
http://dba-oracle.com/t_ora_12514_tns_listener_does_not_currently_know_service_requested.htm but no use. Thanks


EDIT:
here's the output to lsnrctl service

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 3 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
      "ORACLE SERVER" established:0 refused:0 current:0 max:25 state:ready
        CLRExtProc
     (ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\NTN_6B4_641B624E_B22.ORA))
  "ORACLE SERVER" established:0 refused:0 current:0 max:25 state:ready
     CLRExtProc
     (ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\NTN_6B4_641B624E_282.ORA))
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 "XEXDB" has 1 instance(s).
 Instance "xe", status READY, has 1 handler(s) for this service...
 Handler(s):
  "D000" established:0 refused:0 current:0 max:1022 state:ready
     DISPATCHER <machine: JAINAM-2B1C493D, pid: 3708>
     (ADDRESS=(PROTOCOL=tcp)(HOST=jainam-2b1c493d)(PORT=2763))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0 state:ready
     LOCAL SERVER
The command completed successfully

回答1:

One of the reasons you get that kind of error is because database instance started before listener did. Listener must always be started first.

  1. Check if a database instance is up and running
  2. Check the output of the lsnrctl service command and see what services are registered.
  3. Check if you have SERVICE_NAME correctly specified when connecting to the instance.
  4. If it happens that database instance stared before listener did, sometimes you just need to wait a little or you can execute alter system register in order to register the instance.


回答2:

For me it helped to add the following SID_DESC into the C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    ...
    (SID_DESC =
      (SID_NAME = XE)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
    )
  )

After restarting listener and database the access worked again.

Thanks to http://grow-n-shine.blogspot.de/2011/11/oracle-11g-xe-issue-ora-12514.html



回答3:

Open SQL Plus and connect to System User:

system/p@ssword

And run two commands:

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


标签: oracle11g tns