ORA 12154 - unable to connect from toad/SQLplus - oracle

when i try to connect any DataBase in my TNSNAMES.ora file SQLPLUS throws
ORA-12154: TNS could not resolve service name
I've already checked this stuff:
TNS_ADMIN environment variable is defined as "C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN"
"C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\tnsnames.ora" was located
The following connect descriptor was found for my_db in the tnsnames.ora file
my_db=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=local.db)
(PORT=1521)
)
(CONNECT_DATA=
(SID=SCMPROD)
)
)
"C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\sqlnet.ora" was located
NAMES.DIRECTORY_PATH specifies TNSNAMES in the sqlnet.ora file
the question is:
what is missing?
UPDATE
Now on SqlPlus using the usr/pwd#SELFTEST connection string it works
In can't be an error on the server because on my old PC it still accept my connection an all my company works on it.
The tnsname.ora
SELFTEST=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=10.100.2.7)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=GOLDtest)
)
)
The problem still exist trying to connect from Toad for Oracle...

ORA-12154: TNS could not resolve service name
my_db=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=local.db)
(PORT=1521)
)
(CONNECT_DATA=
(SID=SCMPROD)
)
)
The error is about incorrect service name. I see your tnsnames.ora doesn't have the service_name, rather you have mentioned SID. Probably this is the cause of the error.
You could edit the tnsnames.ora as:
SCMPROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SCMPROD)
)
)
Assuming, SCMPROD is the service_name.

From the source
ORA-12154: 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.

Related

Oracle change connection identifier

I have 2 Oracle database installed on 2 different server (production and test) but I'm not Oracle expert. In production I can connect succesfully via SQLPLUS using:
sqlplus user/password#bc.name.server.com
In test system I have to specify different connection string:
sqlplus user/password#bc.name.server.com:1521/orcl
Whithout the :1521/orcl I got: ORA-01017: invalid username/password; logon denied
For scripting purpose, I would like to use the same connection string but I'm stuck on how to change it.
I tried to change the tnsnames.ora as:
ORCLCDB=localhost:1521/orclcdb
bc.name.server.com=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
But still not work. Could someone address me on how I can change the connection string to:
sqlplus user/password#bc.name.server.com
Thank you
Lucas
This is how I do that; see if it helps.
As every Oracle piece of software uses its own TNSNAMES.ORA file (for example, if you installed Oracle database and Developer Suite, you'd have two TNSNAMES.ORA files). In order to be able to connect to different databases, you have to maintain TNSNAMES.ORA in both (or more) directories. To avoid that, create TNS_ADMIN environment variable which points to a directory that contains a single copy of the TNSNAMES.ORA file. Therefore, when I add a new database to connect to, I maintain it only in that TNSNAMES.ORA file. On my computer, it is set to
SQL> $set tns_admin
TNS_ADMIN=C:\oralib
Contents of my SQLNET.ORA file:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Contents of my TNSNAMES.ORA (part of it, though; in reality, I currently have aliases to 56 databases in there):
MY_TEST_DB=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=my_test_host)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SID=db_test)
)
)
MY_PRODUCTION_DB=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=my_production_host)
(PORT=1521)
)
)
(CONNECT_DATA=
(SID=db_production)
)
)
When I'm connecting to these databases, I run (at the operating system command prompt)
sqlplus scott/tiger#my_production_db
or
sqlplus scott/tiger#my_test_db
and everything works just fine.

How to test Oracle ODBC Driver Configuration connection?

I was trying to install both Oracle instantclient-basic-windows.x64-12.1.0.2.0 and instantclient-odbc-windows.x64-12.1.0.2.0
I am getting the following error then testing the ODBC driver configuration:
My tnsnames.ora file has:
UASERVER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(COMMUNITY=TCP)
(PROTOCOL=TCP)
(HOST=10.3.240.40)
(PORT=1521)
)
)
(CONNECT_DATA=(SERVICE_NAME=RPA-DEV))
)
Could anyone please help me to solve this?
Punya, the message indicates the service name is wrong so if you have the correct port specified I suspect the service name needs a dot extension. Does the sqlnet.ora file provide a default domain? As Alex suggested you should check to see what the target listener is listening for via a status command.

ORA-12154 TNS can't resolve specified identifier

i'm trying to connect to my oracle server using a batch file, but while i try connecting i got the following error:
ORA-12154: TNS: could not resolve the connect identifier specified
I've already check the tnsnames.ora ad the identifier is spelled correctly; i've put in the environment's variable a new variable named TNS_ADMIN that point on my admin folder in the client section.
ty tnsname.ora is as following
ORCL_SRVDATIORIO12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
(SERVER = DEDICATED)
)
)
If i try connecting to that server using SSMA for example, using the tnsnames mode (SID or the description name), connection will establish just fine; while running it in command line it return me the error.
Also if i try running
tnsping <my tnsname>
i'll get:
TNS Ping Utility for 32-bit Windows: Version 12.2.0.1.0 - Production on 03-GEN-2019 14:36:59
Copyright (c) 1997, 2016, Oracle. All rights reserved.
File di parametri utilizzati:
C:\app\client\user\product\12.2.0\client_1\network\admin\sqlnet.ora
TNS-03505: Impossible finding name
So i checked the sqlnet.ora file and the directory path seems fine to me:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, LDAP)
any suggestion?
EDIT: i solved by simply creating a new text file and copy past the previous contents in the new one.
you need to check tnsnames.ora. tnsnames.ora contains tns names and their connection declarations. You need to use appropriate tns name to connect your database.
tnsping <tns_name> //tns_name is needed to be defined in tnsnames.ora
in your case
tnsping ORCL_SRVDATIORIO12 10
need to return success message. if it does not, it means that your connection decriber is wrong. In which case, you need to talk with your DBA

Connecting Oracle with unixODBC: TNS:net service name is incorrectly specified

I am trying to connect from Ubuntu to Oracle in Windows Server. I have installed unixODBC and Oracle driver to Ubuntu. When I try to connect using isql it gives following error:
user#user:~$ isql -v oracle-jono username password
[S1000][unixODBC][Oracle][ODBC][Ora]ORA-12545: Connect failed because target host or object does not exist
[ISQL]ERROR: Could not SQLConnect
And when I run it with sudo I get different error:
[S1000][unixODBC][Oracle][ODBC][Ora]ORA-12162: TNS:net service name is incorrectly specified
I have tried many combinations of enviranment variables without success (ORACLE_HOME, ORACLE_SID, TNS_ADMIN, TWO_TASK). This is my very first time I am doing anything with Oracle so practically I don't know anything about it. I have also tried to modify odbc.ini and tnsnames.ora files.
My odbc.ini for this Oracle connection:
[oracle-jono]
Description = ...
Driver = OracleDriver
Server = 111.222.111.222
User = ...
Password = ...
Port = 1521
Database = mydatabase
My tnsnames.ora:
Data Source=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=111.222.111.222)
(PORT=1521)
)
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=mydatabase)
)
);User Id=...;Password=...;
Is there something clearly wrong? What should I put to environment variables? Do I have to do something in Windows Server where Oracle database exits (for example Oracle listeners)?
I tried many many things and not sure which of them worked but my guess is that ServerName in odbc.ini fixed this error:
[oracle-jono]
Description = ...
...same as above...
ServerName = //111.222.111.222:1521/mydatabase

ERROR 704 & 12154 while connecting sqlloader to server

I have a oracle database based on a server, and I want to import the data in the tables on the server.
I am trying to use sqlloadr(sqlldr) for inserting all data in the oracle database, which is on localhost and there is no problem in this case, but the problem occurs while I try to connect a web-server(not localhost).
The command that I've used in localhost case:
sqlldr <usrname>/<password> control=table.ctl log=table.log ERRORS=25000
and following is concerning to web-server
sqlldr <usrname>/<password>#LABSERVER control=table.ctl log=table.log ERRORS=25000
where I created a tnsnames.ora as following:
LABSERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = <hostaddress>)(Port = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = <servicename>)
)
)
but I got this error:
SQL*Loader-704: Internal error: ulconnect:OCIServerAttache [0]
ORA-12154: TNS:could not resolve the connect identifier specified
Any idea will be appreciated
We had a similar issue and did not have privileges to modify tnsnames.ora on local, so we had to specify the service in the command line like:
sqlldr userid=username/password#\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myDBHost)(PORT= 1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=MYDBSID)))\" Control='mytable.ldr' Log='mytable.log'
thanks to https://hs2n.wordpress.com/2012/06/12/oracle-using-sqlplus-and-sqlldr-on-databases-without-tnsnames-entry/#comment-700
"where I created a tnsnames.ora which
is like following:"
That seems to mean you have posted the TNSNAMES.ORA file from the database server.
Remember you also need a TNSNAMES.ORA file on the client. Is that correctly configured too?
Basically this error is telling you that given the host, port, protocol and service_name the client could not find a listening Oracle service. Make sure that your hostname is valid (e.g., you can ping it), that the listener is listening on 1521, and that the service_name in the server database is really the name you specified. You can verify it by issuing this command in sqlplus:
SHOW PARAMETER service_names
which tells you what the database is registering itself as with the listener.
For those, like me, who found this thread.
One thing to check: file permissions on the tnsnames.ora file.
For clients on the same machine yet not part of the DBA group and with ORACLE_HOME and ORACLE_BIN set correctly subject error was reported. File permissions of the tnsnames.ora file precluded world read; as the tnsnames.ora file could not be read 704 / 12514 thrown as service name could not be resolved.
From command prompt: chmod 644 $ORACLE_HOME/network/admin/tnsnames.ora
if your password has a # character , then sqlldr utility will not work , change ur password it will work
http://www-01.ibm.com/support/docview.wss?uid=swg21347615

Resources