Ora 12154 tns error in oracle 12c 11g and 10g
Error ( Ora 12154 ) Message is : TNS:could not resolve the connect identifier specified.
TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 20-AUG-2017 00:01:49
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = oradb11)))
OK (10 msec)
[oracle@rsrvt134 admin]$ sqlplus kkasari/password@oradb1
SQL*Plus: Release 12.1.0.2.0 Production on Sun Aug 20 00:01:52 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Enter user-name:
( Answer is corrected the service name to oradb11 to oradb1 )
------------------------------------------------------------------------------------------------------------------
To configure oracle database remote connectivity we need four details...
TNS File ( tnsnames.ora )
---------------------------------
oradb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED ) - Optional
(SERVICE_NAME = oradb1)
)
)
One of my client has faced ora 12154 error while he configuring the database connectivity network using tnsnames.ora file with the provided details ( Service Name, Hostname, Port Number ) but he is facing issue, when we verified all the details which provided seems to be fine but customer still facing the issue, we did lot of digging to resolve the issue while i was searching in google i found most of the people are facing the same issue what i am looking, so that's why i decided to share the my tns error resolving log with you.
we have faced many ora 12154 tns error issues, i have copied all the logs and sharing one by one, i believe your situation suits any one of them, also i have mentioned in detailed description how to give tnsnames.ora configuration. In case if i miss anything please comment below i will paste on same page that will help to others.
Below is one scenario where customer had done the mistake, instead of giving oradb1 he has mentioned wrong service name oradb11 due to connectivity failed
---------------------------------------------------------------------------------------------------------
[oracle@rsrvt134 admin]$ tnsping oradb1TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 20-AUG-2017 00:01:49
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = oradb11)))
OK (10 msec)
[oracle@rsrvt134 admin]$ sqlplus kkasari/password@oradb1
SQL*Plus: Release 12.1.0.2.0 Production on Sun Aug 20 00:01:52 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Enter user-name:
( Answer is corrected the service name to oradb11 to oradb1 )
SQL> show parameter service_name
Name Type Value
----------- ------------ -----------------
service_name string ORADB1
To configure oracle database remote connectivity we need four details...
- Tns Service Name
- Host Name
- Port Number
- Database Service Name
Tns Service name - you can choose any name, it would be good if the name is related and meaning full to related with database name.
Hostname - Specify server ( IP Address / Hostname ) name where the database exists.
Port Number - Port number must match with the server side listener port number, be careful when you have multiple listener entries in a single file.
Service Name - Maximum database name is the service name in case if you have any doubt please check with using below parameter.
SQL> show parameter service_name
Name Type Value
----------- ------------ -----------------
service_name string ORADB1
TNS File ( tnsnames.ora )
---------------------------------
oradb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED ) - Optional
(SERVICE_NAME = oradb1)
)
)