This discussion is archived
5 Replies Latest reply: Jan 27, 2013 10:15 PM by 987439 RSS

Can not connect to server.  TNS: no listener

886626 Newbie
Currently Being Moderated
I have Oracle 11g on my server and I have installed Virtual PC for Windows 7 on it. I installed InstantClient on the Virtual PC to access the database. The listener on my server is up and running. In fact I have restarted it quit a few times when trying different things.
My tnsnames.ora looks like this:
LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


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

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.0.0.68)
    )
  )
and my listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\bgLAB\product\11.2.0\dbhome_2)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\bgLAB\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    )
  )

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

ADR_BASE_LISTENER = C:\app\bgLAB
I'm trying to connect using scott/****@localhost:1521 and it gives the no listener error.
Since Instant Client does not have tnsping or other utilities, I don't know how to figure this out! Please help!
  • 1. Re: Can not connect to server.  TNS: no listener
    orafad Oracle ACE
    Currently Being Moderated
    It does not seem this thread belongs in the Instant Client forum, with a issue not specific to IC in any way.
    niki wrote:
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    That listener will only accept local connections. If you "sit" on the host itself, you should be able to connect via listner, but not from another machine.

    Try renaming listener.ora.
    Stop listener, move file to say listener.ora_moved, start listener.
    Look at lsnrctl stat output in the endpoints section.

    I'm trying to connect using scott/****@localhost:1521 and it gives the no listener error.
    As localhost means "myself", it points to loopback interface/network, is the connection string correct?

    After changing the listener per above, to listen on all interfaces, try scott@'server hostname:1521/service_name'.
  • 2. Re: Can not connect to server.  TNS: no listener
    886626 Newbie
    Currently Being Moderated
    Thanks for your reply. I was thinking about putting this in another forum if no one replies! :)
    I changed the localhost to another name, but it wasn't being recognized at all when trying to start the listener. I even tried the IP address of the client, same error:
    Connect failed because target host or object does not exist!!
  • 3. Re: Can not connect to server.  TNS: no listener
    LaurenzAlbe Journeyer
    Currently Being Moderated
    niki wrote:
    I changed the localhost to another name, but it wasn't being recognized at all when trying to start the listener. I even tried the IP address of the client, same error:
    No, you got that all backwards.
    listener.conf is on the database server, and you'll have to specify the server's address, not the client's.
    It specifies on which interface the server should listen.

    Yours,
    Laurenz Albe
  • 4. Re: Can not connect to server.  TNS: no listener
    886626 Newbie
    Currently Being Moderated
    Thanks guys. I finally got connected. In case someone else is confused like me, I connected with:
    scott/****@<name_of pc>:1521/orcl.0.0.68 when I put the <nameof_pc> in place of localhost inside my listener.ora.
  • 5. Re: Can not connect to server.  TNS: no listener
    987439 Newbie
    Currently Being Moderated
    Your configuration is very bad!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points