ORA-12154: TNS:could not resolve the connect identifier specified [message #500124] |
Thu, 17 March 2011 16:45 |
|
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 #500347 is a reply to message #500340] |
Sat, 19 March 2011 15:26 |
|
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
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 #500546 is a reply to message #500366] |
Tue, 22 March 2011 02:51 |
|
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
|
|
|