Home » RDBMS Server » Networking and Gateways » ORA-12154: TNS:could not resolve the connect identifier specified (Debian 2.6.26-21lenny4)
ORA-12154: TNS:could not resolve the connect identifier specified [message #500124] Thu, 17 March 2011 16:45 Go to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
Hi,

As i have little clue what i will write down - i will try to be as much specific as i can.

What works:

There is a oracle database on the local network. I'm connecting to it through my web server on my pc (apache/php). I have installed "oracle_instantclient10". It works fine - i can connect to oracle db, queries are executed fine.

What doesnt work:

I'm trieing to connect to the same oracle db from a Linux server, but i get the error:

 ORA-12154: TNS:could not resolve the connect identifier specified 


My linux server can connect to remote oracle db, because
"nmap ORACLE_DB_MACHINE_IP -PN", gives me answer "1521/tcp open oracle". I have the same firewall allowance with my winXp pc.

I use the same "TNSNAMES.ORA" and "SQLNET.ORA" files on both: linux server, winXp pc.

The only difference between winXp and linux machines is that winXp uses oracle instant client version 10.2, and linux uses version 11.2.

Can the version thing can be the case?






Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500126 is a reply to message #500124] Thu, 17 March 2011 17:09 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>The only difference between winXp and linux machines is that winXp uses oracle instant client version 10.2, and linux uses version 11.2.
>I use the same "TNSNAMES.ORA" and "SQLNET.ORA" files on both: linux server, winXp pc.
using same sqlnet.ora could be a problem

please post content of sqlnet.ora

>Can the version thing can be the case?
NO!
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500204 is a reply to message #500126] Fri, 18 March 2011 01:12 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
Here it is:

NAMES.DEFAULT_DOMAIN = tele2.lan

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


tnsnames.ora file is:

NNM.TELE2.LAN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.170.199)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = NNMDB)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )



AND i connect to the db with php oci_connect() function. Full command is:

oci_connect("user_name","pass_word",'NNM.TELE2.LAN')



Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500233 is a reply to message #500204] Fri, 18 March 2011 08:51 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>SQLNET.AUTHENTICATION_SERVICES= (NTS)
Consider seriously & in depth what this means & does.
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500326 is a reply to message #500233] Sat, 19 March 2011 09:49 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
OK. I got what you meant. It definitely should not be set to NTS, as it is only for windows.
I tried to set it to : NONE, ALL, DCEGSSAPI, RADIUS, KERBEROS5
But still get the same error Sad
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500328 is a reply to message #500326] Sat, 19 March 2011 09:51 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
Also tried to delete whole line from the file

[Updated on: Sat, 19 March 2011 09:51]

Report message to a moderator

Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500331 is a reply to message #500328] Sat, 19 March 2011 10:01 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/

>OK. I got what you meant. It definitely should not be set to NTS, as it is only for windows.
CORRECT!

From where I sit it is not clear which copy of sqlnet.ora you changed.
Just as a test case, I suggest both files be renamed out of the way to avoid any & all confusion.
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500334 is a reply to message #500331] Sat, 19 March 2011 10:32 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
I'm sorry if I broke any of posting rules. I'll try one more time
Though I don't know what I did wrong after reading guidelines Sad

>From where I sit it is not clear which copy of sqlnet.ora you changed

Every change was made in "/usr/lib/oracle/11.2/client/network/admin/sqlnet.ora" file.
(TNS_ADMIN enviroment variable is set to "/usr/lib/oracle/11.2/client/network/admin")

>Just as a test case, I suggest both files be renamed out of the way to avoid any & all confusion.
What do you mean by that? "TNSNAMES.ORA" and "SQLNET.ORA" files? There are no copies.

Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500336 is a reply to message #500334] Sat, 19 March 2011 10:53 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Every change was made in "/usr/lib/oracle/11.2/client/network/admin/sqlnet.ora" file.
How/why would Windows client read sqlnet.ora on DB Server?

>Just as a test case, I suggest both files be renamed out of the way to avoid any & all confusion.
I meant BOTH sqlnet.ora on Windows & Unix!
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500339 is a reply to message #500336] Sat, 19 March 2011 12:07 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
>How/why would Windows client read sqlnet.ora on DB Server?
I don't know. This file was in the Oracle Instant Client installation folder on my winXP PC.
When I installed Oracle Instant Client to linux PC, configuration needed sqlnet.ora file, so i copied what i found on my winXP PC

OK. I renamed sqlnet.ora on my linux pc. Then i got another error:

ORA-12169: TNS:Net service name given as connect identifier is too long 


Searched through web and found, that the problem could be copying "TNSNAMES.ORA" file from windows to linux:
Quote:

A common problem is when copying a tnsnames.ora file from windows to linux, it probably have \r\n instead of \n causing this problem.


Then I edited "TNSNAMES.ORA" file with gedit and saved it. Tried to run the sript - got the first error

ORA-12154: TNS:could not resolve the connect identifier specified 
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500340 is a reply to message #500339] Sat, 19 March 2011 12:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
here is my problem
I only know what you post.
>Tried to run the sript - got the first error
I don't know what script contains.
I don't know upon which system script resides.
I don't know upon which system Oracle RDBMS resides.
I don't know what software is installed where.
>Then I edited "TNSNAMES.ORA" file with gedit and saved it.
but you choose to NOT post new content so only YOU know what it now contains.
I don't know upon which system this tnsnames.ora resides.

My car won't go.
Tell me how to make my car go.
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500347 is a reply to message #500340] Sat, 19 March 2011 15:26 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
You're absolutely right. I'm a bit embarrassed.
So:

winXP PC runs:
- Apache/2.2.14
- PHP Version 5.3.1
- Connecting to oracle db with php extension oci8 (1.3.5)

linux pc (Debian 2.6.26-21lenny4) is a virtual server. I connect to it remotely with a putty client:
- Apache/2.2.9
- PHP Version 5.2.6-1+lenny9
- Connecting to oracle db with php extension oci8 (1.4.5)

About the php script:

Connecting to db with a script:
$dbhandle = oci_connect("username","password",'NNM.TELE2.LAN');
$stid = oci_parse($dbhandle, $query);
$r = oci_execute($stid);


I run the script in the web interface in my winXP PC.

Sadly, but i have no information about Oracle RDBMS. But i am sure, that it is unix based system.

TNSNAMES.ORA file content:
NNM.OMNITEL.LAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.170.199)(PORT = 1521))
(LOAD_BALANCE = yes))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NNMDB)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5))))


I deleted all tab spaces, so now it is hard to read Sad

Hope, this is everything what is needed to say.

[Updated on: Sat, 19 March 2011 15:27]

Report message to a moderator

Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500349 is a reply to message #500347] Sat, 19 March 2011 16:12 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>$dbhandle = oci_connect("username","password",'NNM.TELE2.LAN');
>NNM.OMNITEL.LAN =

compare & contrast the 2 lines above.
What do you notice?
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500352 is a reply to message #500349] Sat, 19 March 2011 16:54 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
Damn it. I inserted the wrong "TNSNAMES.ORA" file content.
Naming is OK. This is because some distraction
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500353 is a reply to message #500352] Sat, 19 March 2011 17:13 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Naming is OK.
I'm glad to hear the problem has been solved.
Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500366 is a reply to message #500353] Sun, 20 March 2011 03:05 Go to previous messageGo to next message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
No no. You misunderstood me.
Script is:
$dbhandle = oci_connect("username","password",'NNM.TELE2.LAN');
$stid = oci_parse($dbhandle, $query);
$r = oci_execute($stid);

"TNSNAMES.ORA" is:
NNM.TELE2.LAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.170.199)(PORT = 1521))
(LOAD_BALANCE = yes))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NNMDB)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5))))



Re: ORA-12154: TNS:could not resolve the connect identifier specified [message #500546 is a reply to message #500366] Tue, 22 March 2011 02:51 Go to previous message
markop
Messages: 10
Registered: March 2011
Location: Lithuania
Junior Member
I have found what was the problem. As I mentioned before

Quote:
A common problem is when copying a tnsnames.ora file from windows to linux, it probably have \r\n instead of \n causing this problem.


I tried to change newline symbols manualy, but it didn't work. So, while I was searching solution I've found automatic thing to do such thing (it seems there are a lot of ways to do this). One of them:

tr -d '\r' < ./network/admin/tnsnames.ora_windows_file > ./network/admin/tpm_tnsnames.ora_linux_file


Thanks for posting advices. In the future I will be more specific and attentive
Previous Topic: Unable to start listener
Next Topic: Listener password
Goto Forum:
  


Current Time: Fri Mar 29 07:48:39 CDT 2024