Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> Re: tnsnames.ora not working ?

Re: tnsnames.ora not working ?

From: Reuben D. Budiardja <>
Date: Tue, 20 Jan 2004 08:14:26 -0800
Message-ID: <>


On Tuesday 20 January 2004 11:01 am, Mercadante, Thomas F wrote:
> Reuben,
> If the normal connection is throwing an error, then it stands to reason
> that the seond one would not connect either. You need to get a connection
> working first before you try something else.

I can confirm that this:
$> sqlplus
Enter user-name:
developer@(description=(address=(protocol=tcp)(host=hostname)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = dev_db)))

work just fine. That why I'm confused why using tnsnames.ora by putting that entry in tnsnames.ora does not work. The entry is given to me by the DBA of the server I'm trying to connect to.

> The Oracle error you are getting is complaining about the service_name
> entry. Is this the same value for the database that you are trying to
> connect to?

I'm not sure what you meant, but I suppose yes. The DBA gave me those entry that I copy-paste in my previous message.

> Is the database advertising itself as a service of dev_db?
As far as I know, yes.

I'm thinking the problem is more in the client side (me) rather than the server side. Am I correct ?

> Fix this first and get the connection to work via the normal method. And
> then you can try the other method.

What do you mean by "normal method"? Is there a fundamental difference or assumption that I made that may not be true when I'm making connection by passing all the information in the user-name field and by using service name (like developer_at_dev_db) that is defined in tnsnames.ora?

> And, finally, why in the world do you want to do this?

ummm, do what? What I want is to define that entry in tnsnames.ora so when I want to connect I can just type developer_at_dev_db as my username, rather than using the long description.

Thanks for any help.
> Tom Mercadante
> Oracle Certified Professional
> -----Original Message-----
> From: Reuben D. Budiardja []
> Sent: Tuesday, January 20, 2004 10:49 AM
> To: Multiple recipients of list ORACLE-L
> Subject: tnsnames.ora not working ?
> Hello,
> I'm trying to add description in my
> $ORACLE_HOME/network/admin/tnsnames.ora,
> but it seems that the client (ie. sqlplus) wont use it. Whenever I try to
> connect to the service using sqlplus, I got :
> $> sqlplus
> Enter user-name: developer_at_dev_db
> Enter password: *****
> ORA-12154: TNS:could not resolve service name
> I tried to add the description to my ~/.tnsnames.ora too with no luck. The
> entry in the tnsnames.ora is:
> DEV_DB =
> (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
> )
> (SERVICE_NAME = dev_db)
> )
> )
> (note: I removed the real hostname for privacy/security reason of course)
> However, when I use sqlplus using the following way:
> $> sqlplus
> Enter user-name:
> developer@(description=(address=(protocol=tcp)(host=hostname)(PORT =
> 1521))(CONNECT_DATA =(SERVICE_NAME = dev_db)))
> Enter password: *****
> It would work, where all the information from the description is just a
> copy-paste from the tnsnames.ora file.
> Is there anything I overlook? Sorry if this is kinda a newbie question. I'm
> still learning my way around this. I'm using Oracle9i on Redhat Linux.
> Thanks for any help.
> Reuben D. Budiardja

Reuben D. Budiardja
Department of Physics and Astronomy
The University of Tennessee, Knoxville, TN
"To be a nemesis, you have to actively try to destroy 
something, don't you? Really, I'm not out to destroy 
Microsoft. That will just be a completely unintentional 
side effect."
                 - Linus Torvalds -

Please see the official ORACLE-L FAQ:
Author: Reuben D. Budiardja

Fat City Network Services    -- 858-538-5051
San Diego, California        -- Mailing list and web hosting services
To REMOVE yourself from this mailing list, send an E-Mail message
to: (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jan 20 2004 - 10:14:26 CST

Original text of this message