16.5 Example of Troubleshooting a TNS-12154 Error

This section offers some solutions for the TNS-12154 error. The TNS-12154 error is encountered when SQL*Net cannot find the connect identifier specified for a connection in the tnsnames.ora file or other naming adapter.

Before attempting to resolve the problem, it may be helpful to print out or view the tnsnames.ora file and the sqlnet.ora file. Looking at these files at the same time is helpful because references are made to both.

In this example, the tnsnames.ora and sqlnet.ora files are located in the default network administration directory on the client system.

Be sure that the tnsnames.ora file and the sqlnet.ora file resemble the following examples.

The following is an example of a tnsnames.ora file:

Example 16-1 tnsnames.ora Sample

DEV1.WORLD =
     (DESCRIPTION =
           (ADDRESS =
             (PROTOCOL = TCP)
             (HOST = 192.0.2.56)
             (PORT = 1521)
           )
       (CONNECT_DATA = 
         (SERVICE_NAME = sales.example.com)
       )
     )

The following is an example of a sqlnet.ora file:

Example 16-2 sqlnet.ora Sample

TRACE_LEVEL_CLIENT = OFF
SQLNET.AUTHENTICATION_SERVICES = (NONE)
NAMES.DIRECTORY_PATH = (TNSNAMES)
AUTOMATIC_IPC = OFF

The alias in Example 16-1 is DEV1.WORLD. However, the NAMES.DEFAULT_DOMAIN = WORLD parameter does not exist in Example 16-2. To fix this problem, add the NAMES.DEFAULT_DOMAIN = WORLD parameter anywhere in the sqlnet.ora file. Save the file, and try the connection again.