Link to home
Start Free TrialLog in
Avatar of DCCoolBreeze
DCCoolBreeze

asked on

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 192.168.0.103
 
TNS Ping Utility for Linux: Version 9.2.0.1.0 - Production on 17-NOV-2003 15:38:31
 
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
 
Segmentation fault
[delaware@localhost delaware]$
Avatar of arjanh
arjanh

Have you started the TNS listener with the lsnrctl command?
as in
lsnrctl start
Avatar of seazodiac
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.


Avatar of DCCoolBreeze

ASKER

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/ldifsample.map.master
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 ;-)
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/'
TRACE_FILE_CLIENT = CLIENT
TRACE_LEVEL_CLIENT = 16
to the sqlnet.ora file in the linux client .
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)
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.
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...
DCCoolBreeze:

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

and

$tnsping VADHome.world
This may be part of the answer.  I loaded Oracle 9iAS Client.

[delawaredh@localhost delawaredh]$ tnsping vadhome
 
TNS Ping Utility for Linux: Version 9.2.0.1.0 - Production on 17-NOV-2003 21:12:57
 
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
 
Segmentation fault
[delaware@localhost delaware]$ tnsping vadhome.world
 
TNS Ping Utility for Linux: Version 9.2.0.1.0 - 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.
that sounded like a great idea and I tried it earlier...unfortunately neither worked...
DCCoolBreeze:

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.

still no luck
I am stumped too...here.

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:

REKS816.RILA.us =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bigbluenew.rila.us)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = REKS816)
     )
  )
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/libzip.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference (libzip.so)Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM

DCCoolBreeze:

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.
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/GRAY.pf

When I got this error before, I copied GRAY.pf 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?
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/GRAY.pf
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/GRAY.pf
Unable to read the list of homes from the inventory.
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.
thanks.  I have done that.  The installation got beyond the "linking..." issue on install.  now I have the problem with the GRAY.pf 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....
Yes I am doing that but I keep getting the error I mention earlier "... GRAY.pf..."  I do not know what to do...
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
 
Exiting
java.lang.NullPointerException
        at oracle.ewt.lwAWT.BufferedApplet.<init>(Unknown Source)
        at oracle.sysman.emSDK.client.appContainer.WebApplication.<init>(WebApplication.java:751)
        at oracle.net.mgr.container.NetApplication.<init>(NetApplication.java)
        at oracle.sysman.emSDK.client.appContainer.WebApplication.main(WebApplication.java:3315)
[

ASKER CERTIFIED SOLUTION
Avatar of seazodiac
seazodiac
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.