Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

Łukasz picture Łukasz · Dec 3, 2015 · Viewed 17.9k times · Source

I had my database working for over a year since yesterday. Out of sudden, I am no longer able to connect.

enter image description here

Error I am getting is:

Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

Oracle 11.2 Windows 7

Both db and the listener are up and running. Port 1521 is opened.

C:\Apps\Oracle\product\11.2.0\dbhome_1\BIN>netstat -a -n -o| findstr "1521"
  TCP    127.0.0.1:1521         0.0.0.0:0              LISTENING       2412

trying to log in via sqlplus

C:\depot\SBApp\main>sqlplus sbdba0/sbdba0@SBDB

SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 3 10:04:29 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Error:

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

Listener.ora

# listener.ora Network Configuration File: C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\Apps\Oracle\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\Apps\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:\Apps\Oracle\product

tnsnames.ora

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

###################################################################################################
#SBDB
SBDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SBDB)
    )
  )

ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_QA.ora

ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_PROD.ora

I am out of ideas, any help will be appreciated.

Answer

Łukasz picture Łukasz · Dec 3, 2015

solved,

had to replace localhost from *.ora files with my PC hostname.