Oracle 9i: Linux Client: ORA-12154: TNS:could not resolve service name

I have loaded Oracle Client 9i on Redhat 9.  Now went I attempt to connect to a database, I get error ORA-12154: TNS:could not resolve service name.

I can ping the oracle server

when I do a tnsping

[delaware@localhost delaware]$ tnsping
TNS Ping Utility for Linux: Version - Production on 17-NOV-2003 15:38:31
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
Segmentation fault
[delaware@localhost delaware]$
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you started the TNS listener with the lsnrctl command?
as in
lsnrctl start
is this the same problem that you have in window oracle9i client (ignore to suffix the world domain after the service name)?

Aslo your tnsping command is wrong, you can NOT use tnsping with IP address:

the correct format is :

tnsping <oracle_service_name> --defined in your client tnsnames.ora.

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DCCoolBreezeAuthor Commented:
No.  Actually I am reinstalling the client.  Now I get an error of

error in writing to file /opt/ora9/product/9.2/ldap/conf/
DCCoolBreezeAuthor Commented:
ok.  I have reinstalled and run sqlplus username/password@db and get

ORA-12154: TNS:could not resolve service name

I am able to connect to this database from windows so I know that the listener is up
take a look at the sqlnet.ora and tnsnames.ora file in the Linux client .

compare them with the windows clients config. make them the same.
then you should be able to connect, (watch for the domain suffix ;-)
DCCoolBreezeAuthor Commented:
They are exactly the same.  Copied them over from Windows
I am afraid that you have to turn on the TRACE file on the LInux client, and
check the trace log about what exactly happened under the hood.


Add these lines:

TRACE_DIRECTORY_CLIENT = Some fully qualified directory like '/tmp/'
to the sqlnet.ora file in the linux client .
DCCoolBreezeAuthor Commented:
for some reason, I am not getting a log file.  I added the lines to my sqlnet.ora file and run sqlplus to test but no log file shows up...
Have you tried to make sure that the ORACLE user account has the read /write ability to the trace direcotry in linux?

TRACE_DIRECTORY_CLIENT = <some direcotry that User Oracle has write/read rights)
DCCoolBreezeAuthor Commented:
this is really unusual.  The directory has 777 privs yet no log is being saved there or anywhere else
Is the database you are connecting to also a 9i version?
make sure 'SERVICE_NAME =  ' in your tnsnames.ora file for the linux client has the same value as 'GLOBAL_DBNAME= ' in your listener.ora file for the database you are connecting to.
DCCoolBreezeAuthor Commented:
yep 9i.  the tnsnames.ora and the sqlnet.ora files are copied from my windows machine that can access the database.  So...unless the ...ora files are different in Linux then Windows...they should be in the correct format...

That is weird!!!
but as an alternative to approach this :

can you try to tnsping the oracle database server in the linux client?

try both:
$tnsping VADHome


DCCoolBreezeAuthor Commented:
This may be part of the answer.  I loaded Oracle 9iAS Client.

[delawaredh@localhost delawaredh]$ tnsping vadhome
TNS Ping Utility for Linux: Version - Production on 17-NOV-2003 21:12:57
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
Segmentation fault
[delaware@localhost delaware]$ tnsping
TNS Ping Utility for Linux: Version - Production on 17-NOV-2003 21:13:06
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
Segmentation fault
[delaware@localhost delaware]$
I think I have it, check that there is an entry for the database server host name in the /etc/hosts file on linux, if there is no entry try adding it or try using the IP Address of the database host in place of the hostname in the tnsnames.ora file on the client.
DCCoolBreezeAuthor Commented:
that sounded like a great idea and I tried it earlier...unfortunately neither worked...

I read from one of your posts above:

the tnsnames.ora and the sqlnet.ora files are copied from my windows machine that can access the database.  So...unless the ...ora files are different in Linux then Windows...they should be in the correct format...

---->You CANNOT directly copy sqlnet.ora and tnsnames.ora from windows and use it in linux!!!
I think you should use Vi editor or Emacs in linux to create a new copy of tnsnames.ora and sqlnet.ora file with the same contents of windows version because control characters are different between windows and linux.

DCCoolBreezeAuthor Commented:
still no luck
I am stumped

can you try this?

navigate the <oracle_home>/network/admin/ directory, remove all the net config files including tnsnames.ora, sqlnet.ora.

then back to the shell prompt, start the NETMGR tool, a GUI tool that allows you to configure your tnsnames.ora and sqlnet.ora files.

just follow the wizards, and define your profile and database services according to the ones in windows,

and then give it a try after you finish it.

Good luck!
There are many tnsnames.ora and sqlnet.ora files in the machine. Every Oracle product uses it own set of these files. So you have to make sure that you change the real set of these files. Try to figure out how much set you have on your machine. After that try to investigate if you have access to the net - LAN, Internet.

As posted above use NETMGR to establish a service name and test it.
use only existing tnsnames.ora file.


You can use the NETMGR to see if you have the appropriate entry to the server in the local tnsnames.ora file (find it!). I mean that one in the Client .
Under local I mean the file tnsnames.ora  in your application or client, not at the Oracle Server - this is a common mistake.

You have to have there an entry like: =
      (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))
      (SERVICE_NAME = REKS816)
DCCoolBreezeAuthor Commented:
Looks like I have a internal issue.  Perhaps the installation did not complete correctly.

[root@localhost admin]# netmgr
/opt/ora9/jre/1.1.8/bin/../lib/i686/native_threads/ symbol errno, version GLIBC_2.0 not defined in file with link time reference ( to initialize threads: cannot find class java/lang/Thread
Could not create Java VM


What you just encountered is a known issue when running oracle on Linux RH 9.0.

you can get around this by : export LD_ASSUME_KERNEL=2.4.1
then start netmgr

or if you want to make the change permanent , put this line in the .bash_profile file.

by the way, you don't need to be ROOT to run netmgr, you should use the ORACLE ACCOUNT or whatever account you used to install Oracle.
DCCoolBreezeAuthor Commented:
I am reinstalling the client.  I have an error that I got before.  The way I solved it was I copied my java files to the java directories that oracle was creating.  I can only believe that the problem is this so I am cancelling the installation untill I can solve this error...

error in setting permissions of file/directory /opt/oracle/jre/1.3.1/lib/cmm/

When I got this error before, I copied from my existing java 1.3.1_09 directory to the oracle java directory.  This eliminated the error but then another file popped up with the same problem.  I ended up copying all files over and the installation completed.
Can you try my solution before you reinstall?
DCCoolBreezeAuthor Commented:
Here is the log info...

      DllGroup = false

Exception thrown from action: copyExpandedGroup
Exception Name: SetFilePermissionException
Exception String: Error in setting permissions of file/directory /opt/oracle/jre/1.3.1/lib/cmm/
Exception Severity: 2
*** Cancel Dialog:  ***
User selected: Stop installation of all products.

Exception handling set to prompt user with options to  RETRY
User choice : User selected stop installation of all components
Error in setting permissions of file/directory /opt/oracle/jre/1.3.1/lib/cmm/
Unable to read the list of homes from the inventory.
DCCoolBreezeAuthor Commented:
Sorry I had already restarted the installation
I am certain that if you don't do that

export LD_ASSUME_KERNEL=2.4.1

you will have that problem again..

Create an oracle user by following standard install documenation, then setting environment variables including "export LD_ASSUME_KERNEL=2.4.1" in addtion to Oracle_home, Oracle_SID etc.
DCCoolBreezeAuthor Commented:
thanks.  I have done that.  The installation got beyond the "linking..." issue on install.  now I have the problem with the file
you have observed some aberrant inconsistency here. I suggest you to do a clean de-installation using oracle universal installer. and then re-install again....
DCCoolBreezeAuthor Commented:
Yes I am doing that but I keep getting the error I mention earlier "..."  I do not know what to do...
DCCoolBreezeAuthor Commented:
OK.  I have restalled the oracle client.  I am still getting

ORA-12154: TNS:could not resolve service name

when I run netmgr as oracle user, I get

[oracle@dccoolbreeze oracle]$ netmgr
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
        at oracle.ewt.lwAWT.BufferedApplet.<init>(Unknown Source)
        at oracle.sysman.emSDK.client.appContainer.WebApplication.<init>(
        at oracle.sysman.emSDK.client.appContainer.WebApplication.main(

try to run first:

xhost +

then run netmgr

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DCCoolBreezeAuthor Commented:
OK.  When running netmgr and testing a connection, this is the error I get:

Attempting to connect using userid:  dccoolbreeze
The test did not succeed.
ORA-12705: invalid or unknown NLS parameter value specified

There may be an error in the fields entered,
or the server may not be ready for a connection.

If you have installed a lot of oracle product or if you find more then one tnsnames.ora  ans sqlnet.ora files just search which one is beeing really used  and correct those used file.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.