Solved

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

Posted on 2003-11-17
37
4,010 Views
Last Modified: 2012-06-27
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]$
0
Comment
Question by:DCCoolBreeze
  • 17
  • 14
  • 2
  • +3
37 Comments
 
LVL 5

Expert Comment

by:arjanh
ID: 9766679
Have you started the TNS listener with the lsnrctl command?
0
 
LVL 5

Expert Comment

by:arjanh
ID: 9766692
as in
lsnrctl start
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9766762
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.


0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9766921
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
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9767042
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
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9767153
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 ;-)
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9767245
They are exactly the same.  Copied them over from Windows
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9767259
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.

0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9767273

Add these lines:

TRACE_DIRECTORY_CLIENT = Some fully qualified directory like '/tmp/'
TRACE_FILE_CLIENT = CLIENT
TRACE_LEVEL_CLIENT = 16
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9767275
to the sqlnet.ora file in the linux client .
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768060
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...
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9768085
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)
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768370
this is really unusual.  The directory has 777 privs yet no log is being saved there or anywhere else
0
 
LVL 1

Expert Comment

by:jgilbertb
ID: 9768385
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.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768406
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...
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9768411
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
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768426
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]$
0
 
LVL 1

Expert Comment

by:jgilbertb
ID: 9768457
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.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768487
that sounded like a great idea and I tried it earlier...unfortunately neither worked...
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9768495
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.

0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9768537
still no luck
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9768614
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!
0
 
LVL 47

Expert Comment

by:schwertner
ID: 9769906
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)
     )
  )
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9770460
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

0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9770885
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.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9770901
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.
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9770922
Can you try my solution before you reinstall?
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9770927
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.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9770941
Sorry I had already restarted the installation
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9770967
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.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9770983
thanks.  I have done that.  The installation got beyond the "linking..." issue on install.  now I have the problem with the GRAY.pf file
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9773862
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....
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9773967
Yes I am doing that but I keep getting the error I mention earlier "... GRAY.pf..."  I do not know what to do...
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9787042
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)
[

0
 
LVL 23

Accepted Solution

by:
seazodiac earned 500 total points
ID: 9787125
try to run first:

xhost +

then run netmgr
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9796942
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.

0
 

Expert Comment

by:wbiren
ID: 10381636
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.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now