Operating System - HP-UX
1748195 Members
2645 Online
108759 Solutions
New Discussion юеВ

Re: TNS: could not resolve name

 
Ravi_8
Honored Contributor

TNS: could not resolve name

Hi, all
we had installed orcale 7 on HP-UX 10.2 succesfully, no errors while installing , but while logging in ($sqlplus SYS/xxxx@instace_name) it gives the Error:ORA-12154 TNS:could not resolve the name.

any database masters could give us the solution.

thanx in advance
never give up
6 REPLIES 6
Thierry Poels_1
Honored Contributor

Re: TNS: could not resolve name

hi,
try for local DB:
ORACLE_SID=yourinstance
export ORACLE_SID
sqlplus sys/xxxx

for remote DB check your $ORACLE_HOME/network/admin/tnsname.ora file.

good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Stefan Grein
Advisor

Re: TNS: could not resolve name

Hi Ravi,

you can check any Oracle error messager with the oerr command:

oerr ORA 12154
12154, 00000, "TNS:could not resolve service name"
// *Cause: The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action: Make the following checks and correct the error:
// - Verify that a TNSNAMES.ORA file exists and is in the proper
// place and accessible. See the operating system specific manual
// for details on the required name and location.
// - Check to see that the service name exists in one of the
// TNSNAMES.ORA files and add it if necessary.
// - Make sure there are no syntax errors anywhere in the file.
// Particularly look for unmatched parentheses or stray characters.
// Any error in a TNSNAMES.ORA file makes it unusable. See
// Chapter 4 in the SQL*Net V2 Administrator's Guide. If
// possible, regenerate the configuration files using the Oracle
// Network Manager.


BR Stefan
Alexander M. Ermes
Honored Contributor

Re: TNS: could not resolve name

Hi there.
Check your environment. DO you have a file called /etc/oratab ?
The tnsnames.ora should be in $ORACLE_HOME/network/admin
At least a sample should be in a subdirectory named samples.
You will need that file on any computer, taht wants to connect to this database.
You can find some docs on Oracle TechNet or Oracle Metalink.
Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Geetam
Frequent Advisor

Re: TNS: could not resolve name

This Oracle error is fairly new. It indicates that the Oracle client is not using the same name (in tnsnames.ora: (CONNECT_DATA = (SERVICE_NAME = ... ) )) as the database global name (select * from global_name;). The Listener is checking this! You can see what the listener thinks the database is called: look at lsnrctl: "set displaymode verbose" and then "services".

Two ways around it:
1. fix the problem: either: "alter database rename global_name to ..." or: edit tnsnames.ora on the client
2. workaround - tell the database not to be fussy: "alter system set global_names = FALSE" (not recommended by Oracle if you have many databases on your network and you want to use domain names as method of distinguishing; e.g. ora.test.domain and ora.live.domain)
Wodisch
Honored Contributor

Re: TNS: could not resolve name

Hello Ravi,

that clearly is a SQL*Net problem: the TNS was
not able to resolve your parameter "@instance"!
And that is the reason: the third parameter is
NOT the instancename (never has been), but it
is the name of a paragraph describing the
connection from your client station to the
server and the instance running there. Look for
a textfile named "tnsnames.ora" in your oracle
home dir ("$ORACLE_HOME/network/admin/"), or in
"/etc/" and read it - you have to use the name
of the paragraph pointing to your server (that
is the part with "(HOST=hostname)(PORT=1521)")
and the instance there (that looks like
"(SID=yoursid)" a little bit below, usually).
Test it with
tnsping THATNAME
and only if it is responding, use it with
sqlplus.

HTH,
Wodisch
Magdi KAMAL
Respected Contributor

Re: TNS: could not resolve name

Hi Ravi,

1. Try to ping the hostname ( Unix name ).
2. Verify wether the /etc/hosts file contains the right hostname nad IP address.
3. You should verify wether the tnsnames.ora is configured correctly.
4. You should verify wether the Listner is running and responding ( using tnsping ).

Good luck