1

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

I adjust the client on .
TNSPing transits.
But at attempt to incorporate through SQLPLus I receive: ORA-12154: TNS:could not resolve the connect identifier specified
From other machine easy I incorporate.
Where to look?

2

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

Andrey wrote:

I Adjust the client on .
TNSPing transits.
But at attempt to incorporate through SQLPLus I receive: ORA-12154: TNS:could not resolve the connect identifier specified
From other machine easy I incorporate.
Where to look?

How many ORACLE_HOME on the client?
tnsping whence it is caused,
How many TNSnames.ora?
Well and as overtook, as cut...
Commands, an output, files sqlnet.ora, tnsnames.ora
Not in retelling, and in the form of the text of forum SRC/spoiler issued by TAGS - if big

3

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

wrote:

How many ORACLE_HOME on the client?

3

wrote:

tnsping whence it is caused,

From command line.

wrote:

how many TNSnames.ora?

1
[spoiler]
# sqlnet.ora Network Configuration File: C:\ORacle\product\11.2.0\client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES = (NTS)
NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT) [/spoiler]
[spoiler]
DATA1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.43) (PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = app)
)
)
[/spoiler]

4

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

Petrov Andrey;
sqlplus cannot resolve TNS a line of connection
The error of parsing of a file, or it is not present absolutely

$ oerr ora 12154
12154, 00000, "TNS:could not resolve the connect identifier specified"
//*Cause: A connection to a database or other service was requested using
//a connect identifier, and the connect identifier specified could not
//be resolved into a connect descriptor using one of the naming methods
//configured. For example, if the type of connect identifier used was a
//net service name then the net service name could not be found in a
//naming method repository, or the repository could not be
//located or reached.
//*Action:
//- If you are using local naming (TNSNAMES.ORA file):
//- Make sure that "TNSNAMES" is listed as one of the values of the
//NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
//(SQLNET.ORA)
//- Verify that a TNSNAMES.ORA file exists and is in the proper
//directory and is accessible.
//- Check that the net service name used as the connect identifier
//exists in the TNSNAMES.ORA file.
//- Make sure there are no syntax errors anywhere in the TNSNAMES.ORA
//file. Look for unmatched parentheses or stray characters. Errors
//in a TNSNAMES.ORA file may make it unusable.
//- If you are using directory naming:
//- Verify that "LDAP" is listed as one of the values of the
//NAMES.DIRETORY_PATH parameter in the Oracle Net profile
//(SQLNET.ORA).
//- Verify that the LDAP directory server is up and that it is
//accessible.
//- Verify that the net service name or database name used as the
//connect identifier is configured in the directory.
//- Verify that the default context being used is correct by
//specifying a fully qualified net service name or a full LDAP DN
//as the connect identifier
//- If you are using easy connect naming:
//- Verify that "EZCONNECT" is listed as one of the values of the
//NAMES.DIRETORY_PATH parameter in the Oracle Net profile
//(SQLNET.ORA).
//- Make sure the host, port and service name specified
//are correct.
//- Try enclosing the connect identifier in quote marks.
//
//See the Oracle Net Services Administrators Guide or the Oracle
//operating system specific guide for more information on naming.

The reason:
Or there is no file tnsnames.ora in corresponding ORACLE_HOME or there is no such record (it, or the previous record a curve) tnsnames.ora
As a variant
Why tnsping works, and sqlplus - is not present
Or
tnsping and sqlplus at you are caused from different ORACLE_HOME and in them different tns files
Show as you cause
tnsping and sqlplus
Correctly (for your example):

tnsping DATA1
sqlplus user/pass@DATA1
sqlplus user/pass "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST=192.168.20.43) (PORT=1521))) (CONNECT_DATA = (SERVER=DEDICATED) (SERVICE_NAME=app)))"

The last line tns does not use files absolutely and serves for check of syntax of record
Or copy tnsnames in all files
Or define in variables of a surrounding of system

TNS_ADMIN = <the directory where oracle will search TNS for files>

In this case, all ORACLE_HOME will be used by one files
(There are nuances with sqlnet.ora)

5

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

Incorrectly wrote, SQLPlus too connects.
But here at connection ADO from VBS I receive: TNS-12154
The connection is registered here so:

strCon = "Driver = {Oracle in OraClient11g_home1}; Dbq=DATA1; Uid=Login; Pwd=Pass;"

Thus by the adjacent machine works...

6

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

Andrey wrote:

Incorrectly wrote, SQLPlus too connects.
But here at connection ADO from VBS I receive: TNS-12154
The connection is registered here so:

strCon = "Driver = {Oracle in OraClient11g_home1}; Dbq=DATA1; Uid=Login; Pwd=Pass;"

Thus by the adjacent machine works...

OraClient11g_home1 - Look in it TNSNAMES.ora
For check

cmd.exe
set ORACLE_HOME = <Directory OraClient11g_home1>
set PATH = % ORACLE_HOME %\bin; %PATH %
sqlplus user/pass@data1

Or try explicitly:

strCon = "Driver = {Oracle in OraClient11g_home1}; Dbq = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST=192.168.20.43) (PORT=1521))) (CONNECT_DATA = (SERVER=DEDICATED) (SERVICE_NAME=app))); Uid=Login; Pwd=Pass;"

7

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

sqlplus connects and without shamanism.
And here from ADO that with  without TNSNames that with it gives the full line TNS-12154
Can where  does not suffice? Or ways are not registered for ADO?

8

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

Andrey wrote:

sqlplus connects and without shamanism.
And here from ADO that with  without TNSNames that with it gives the full line TNS-12154
Can where  does not suffice? Or ways are not registered for ADO?

sqlplus from what directory?
Once again:
1) Everyone ORACLE_HOME, by default has own adjustments
%ORACLE_HOME %\NETWORK\ADMIN
2) When you  sqlplus - that is caused the first sqlplus.exe found or in a current directory, or in PATH
Not the fact that it will be sqlplus from OraClient11g_home1
For this reason I also suggested to launch check as specified above

9

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

Aha, all is simple:
Long line not is because of BUG

MOS Note: ORA-12154 When Using Long SQLNET Alias in DBQ Property of ODBC Connection String or TNS Service Name of DSN (Doc ID 1340407.1) wrote:

...
BUG:12780172 - PASSING A LONG SQL NET ALIAS IN THE DBQ PROPERTY CAUSES A ORA-12154
BUG:6272483 - PASSING A LONG SQL NET ALIAS IN THE DBQ PROPERTY CAUSES AN ACCVIO
NOTE:239175.1 - Example Connection Strings for use With Oracle Programmatic Interfaces on Windows
...

So adjust either tnsnames.ora or EZConnect string:

192.168.20.43/app
strCon = "Driver = {Oracle in OraClient11g_home1} ;Dbq=//192.168.20.43:1521/app;Uid=Login;Pwd=Pass;"