Help - Search - Members - Calendar
Full Version: Localhost doesnt work in listener.ora or tnsnames.ora
Oracle DBA Forums > Oracle > Oracle Forum
wazzag
Hi,

I want to be able to use "localhost" in my tnsnames.ora and listener.ora files but for some reason its not working.

just concentrating on the listener, when I have the following in my listener.ora the database doesnt register with the listener:

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

This is even after using the "alter system register" command. I'm checking whether my database is registering using "lsnrctl services".

With the following in listener.ora all is fine:
########################################
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.152)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))))
########################################

So why wont it work with localhost?! I'm running Oracle 11G on XP Pro.

I can ping localhost.

Please help!

Thanks,
W
SteveC
You installed a loopback adapter?
burleson
Hi,

>> but for some reason its not working.

Please post the error message and number!

Usually a "localhost" error is a problem with your DNS.

Start by replacing the localhost with the IP address and get that working.

Then, see why your localhost names is not resolved in /etc/hosts

CODE
# cat /etc/hosts | grep localhost

192.168.100.16    myhost.us.mycompany.com   myhost
127.0.0.1         localhost                 localhost.localdomain


If you are on Windows, it's likely some registry crap.

See here, how to configure localhostr a PC:

http://download.oracle.com/docs/cd/B28359_...2010/ap_net.htm

*************************************************
>> I can ping localhost.

You can ping using the hostname? That's a clue!

I use these steps to diagnose connectivity issues:

http://www.dba-oracle.com/t_troubleshootin...vity_errors.htm
wazzag
Thanks for the response. When I use the IP address I have no problems at all.

Using "localhost" :

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

TNSNAMES.ORA
------------------
orcl_localhost =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)



C:\Documents and Settings\Warren>lsnrctl services

LSNRCTL for 32-bit Windows: Version 11.1.0.6.0 - Production on 30-JUL-2010 08:13:29

Copyright © 1991, 2007, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully

***********

C:\Documents and Settings\Warren>sqlplus asp/asp@orcl_localhost

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Jul 30 08:17:53 2010

Copyright © 1982, 2007, Oracle. All rights reserved.

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

Enter user-name:

***********
My hosts entry:

127.0.0.1 localhost

C:\Documents and Settings\Warren>ping localhost

Pinging DF-WG-LAP2 [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
***********

I haven't installed a loopback adaptor - this sounds promising!

Thanks for the help again guys,
Warren
wazzag
Nope - just installed a loopback adaptor, as described here http://download.oracle.com/docs/cd/B19306_...qs.htm#CHDGIFBC, and it didnt fix it :-(
burleson
Hi Warren,

>> The listener supports no services

That's not right! You need to add the SID_LIST to your istener!

http://www.dba-oracle.com/t_sample_listener_ora_files.htm

CODE
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = dnsname)(PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/xxx)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = mysid.com)
      (ORACLE_HOME =/u01/app/oracle/product/xxx)
      (SID_NAME = mysid)
    )
  )



*******************************************************
Sorry, I don't do windows, but you should be able to narrow this down by following my checklist:

http://www.dba-oracle.com/t_troubleshootin...vity_errors.htm

- It works with the IP address, so you know it's related to the DBS resolution

- You can ping using localhost

The next step is to see if you can tnsping

Please add the sid_list and try tnsping and report back!
wazzag
Adding the SID_LIST has fixed it!
So why did this work when I was using IP adresses and no SID_LIST?

So I wonder if the loopback adaptor was needed?


Thanks a lot for your help!
burleson
>> Adding the SID_LIST has fixed it!

Great! Glad we could help!

Tell your friends . . .

***************************************
>> So why did this work when I was using IP adresses and no SID_LIST?

Who knows?

Play around in TEST and see!
Annie
Hi Burleson,

Could you please help. I'm getting the following trying to connection to Oracle 11g Express Edition.

System.Data.OracleClient.OracleException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


1. The Oracle 11g was installed on the Windows Server 2008 r2.
2. Download and extracted the Oracle instant Client to C:\instantclient_12_1
3. Created a tnsname.org file and place at: C:\instantclient_12_1

orcl_localhost =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

I development a .Net program to connection to the Oracle Database, but it is
generated the aboveg error:

Please provide suggestions.

Thank you,
Annie

burleson
Hi Annie and welcome to the forum:

>> ORA-12514

Please read:

http://www.dba-oracle.com/t_tns_12514_on_windows.htm

http://dba-oracle.com/t_ora_12514_tns_list...e_requested.htm


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2015 Invision Power Services, Inc.