Image Image Image Image Image Image Image Image Image Image

Mudassir Shahzad | June 23, 2017

Scroll to top

Top

No Comments

ORACLE/PLSQL: ORA-12154

ORACLE/PLSQL: ORA-12154
Mudassir Shahzad

Learn the cause and how to resolve the ORA-12154 error message in Oracle.

 

Description

When you encounter an ORA-12154 error, the following error message will appear:

  • ORA-12154: TNS:could not resolve service name

 

CAUSE

You tried to connect to Oracle, but the service name is either missing from the TNSNAMES.ORA file or is incorrectly defined.

 

RESOLUTION

The option(s) to resolve this Oracle error are:

 

OPTION #1

Make sure that the TNSNAMES.ORA file exists and is in the correct directory.

In my case, <My directory>:\app\mudassir.shahzad\product\11.1.0\client_1\Network\Admin

OPTION #2

Make sure that there is a file named “sqlnet.ora” in your ..Network>Admin and it contains “TNSNAMES” as a value for “NAMES.DIRECTORY_PATH” property.

If the file is not there, you can copy it from the Sample folder or create a new file named “sqlnet.ora” and copy the following:

 

OPTION #3

Make sure that the service name that you are connecting to is included in the TNSNAMES.ORA file and that it is correctly defined.

OPTION #4

Now, go easy with this. Make sure that there are no syntax errors in the TNSNAMES.ORA file. For example, if there are unmatched brackets in the file (ie: open bracket without the corresponding close bracket), the file will be rendered unusable.

You may think that your file is correct but it might be not. Even an extra space character can cause the error (happened to me, took me a bloody day to figure out!)

 

 

Submit a Comment

not found