ORA-12154: TNS could not resolve the connect identifier specified error comes when you try to connect to Oracle database using clients/tools like SQL Plus, Toad, Oracle Forms, Oracle Reports, and SQL*Net could not find the alias specified for a connection in the TNSNAMES.ORA file or other naming adapters.
Now, let’s reproduce the error and find out the solution for Ora 12154. We are going to use Oracle Forms 11G on the Oracle Web logic server for demonstration.
Internet Explorer (IE) opens and launches the form service, but you get the error as shown below,
What is wrong here?
The form builder is able to connect to the database during design time which happens when you run the form.
Let me explain,
ORA 12154 Solution
Form builder uses default.env file during run time and TNS_ADMIN variable to locate the tnsnames.ora file. Below is the value of this variable.
TNS_ADMIN – C:\Oracle\Middleware\asinst_1\config
So copy the tnsnames.ora file to the location specified by the TNS_ADMIN variable to resolve the ORA 12154 error in Oracle forms. If this does not work, just comment the TNS_ADMIN variable entry in the default.env file as shown below and copy tnsnames.ora file to ORACLE_HOME path.
Then run the forms, your forms should work fine.
Still facing the issue, it means something wrong with TNS entries.
Verify TNSNAMES.ORA and SQLNET.ORA files
First, verify tnsnames.ora and sqlnet.ora file exists in ORACLE_HOME and there is a proper entry of the database to which you are trying to connect.
Below is the default location for tnsnames.ora and sqlnet.ora files for Windows and Linux /Unix Operating System.
Sample TNS entry,
TEST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = xxx.yy.zz.56) (Port = 1521) ) ) (CONNECT_DATA = (SERVICE_NAME = TEST) ) )
Sample SQLNET.ora entry,
TRACE_LEVEL_CLIENT = OFF SQLNET.AUTHENTICATION_SERVICES = (NONE) NAMES.DIRECTORY_PATH = (TNSNAMES)
I am sure the solution mentioned in this article should help you to resolve this TNS 12154 error. If you still facing issues and are not able to resolve them, I would recommend reading the below articles.
- ORA-12154-TNS Could not Resolve the Connect identifier Specificed when Connecting from Forms Builder (Doc ID 1604843.1)
- TNS Issues when connecting to database with Forms Builder 184.108.40.206.0