Select Page

ORA-12154: TNS:could not resolve the connect identifier specified

Jeremiah Wilton | | March 4, 2009

The error also appears in some versions as: “ORA-12154: TNS:could not resolve service name.”

When a program needs to connect to an Oracle service via Oracle Networking (SQL*Net), it must look up the connect data for that service somewhere. When the lookup fails, the Oracle client code raises ORA-12154. Most people will encounter this error when their application tries to connect to an Oracle database service, but it can also be raised by one database instance trying to connect to another database service via a database link.

Note that this error is generated by the Oracle client code on the local host where the program is running, not by the remote Oracle service to which you are attempting to connect.

There are a few ways that the Oracle client code can look up connect data:

  • A flat file named tnsnames.ora
  • Oracle Names service
  • LDAP

If you see the whole ORA-12154 error with the text, then your program is finding a working Oracle client install, but that the Oracle service as specified is not listed in tnsnames.ora, Oracle Names or LDAP. The most common causes of ORA-12154 are:

  • The entry is missing from tnsnames.ora
  • The entry in tnsnames.ora is malformed
  • The program is using tnsnames.ora from the wrong ORACLE_HOME
  • The program is not using a fully-qualified service name, but no default domain is enabled in sqlnet.ora

Most sites use tnsnames.ora, but enough use Oracle Names and LDAP that the first step should be to determine which name resolution method is deployed at your site. If you are not the database administrator, you should get in touch with the people who manage your Oracle systems and find out which method you should be using. Often they will be able to provide guidance for resolving your problem in accordance with your site’s standards.

The client code decides which mechanism to use based on the file sqlnet.ora. This paper writer and tnsnames can usually both be found in the Oracle install directory (“ORACLE_HOME”), under network/admin/. This location may be overridden with the environment variable TNS_ADMIN. If the sqlnet.ora file does not exist, or does not specify a resolution method, then Oracle Net uses tnsnames.ora.

Example locations of Oracle networking files:



UNIX / Linux:


Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

12c Upgrade Bug with SQL Tuning Advisor

Learn the steps to take on your Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Scripting Out the Logins, Server Role Assignments, and Server Permissions

Imagine over 100 logins on the source server, you need to migrate them to the destination server. Wouldn’t it be awesome if we could automate the process?

JP Chen | October 1, 2015

Recover a Table from an RMAN Backup in an Oracle 12c

This blog post will is to show a table restore for one table in a container database.

Megan Elphingstone | February 2, 2017

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.


Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.