A report that ran fine yesterday won’t connect this morning. A new developer can’t reach the test database from a fresh laptop. A scheduled job fails at 2 a.m. while the same login works perfectly from SQL*Plus. Different symptoms, same message on the screen.
That message is ORA-12154: TNS:could not resolve the connect identifier specified. It looks alarming, but it’s one of the more predictable Oracle errors. It means the Oracle client couldn’t turn the name you gave it into a network address, so it never even tried to reach the database. Once you know where Oracle looks for that name, the fix is usually quick.
This guide explains what the error means, why it happens, how to track down the cause step by step, and how to stop it from coming back.
host:port/service works and the alias doesn’t, the problem is name resolution.ORA-12154 means Oracle Net couldn’t find the connect identifier you used in any of its configured naming methods. In Oracle’s words, the identifier “could not be resolved into a connect descriptor using one of the naming methods configured” (Oracle error reference).
A connect identifier is the short name you type after the @ sign, such as sales in sqlplus scott@sales. A connect descriptor is the full address behind it: the host, the port, and the service name. Oracle has to translate one into the other before it can open a connection. When that translation fails, you get ORA-12154.
You may see the error in two forms. The classic wording is the one most people search for. Newer Oracle releases also show a more descriptive version that names the alias and the place Oracle looked:
ORA-12154: TNS:could not resolve the connect identifier specifiedORA-12154: Cannot connect to database. Cannot find alias sales in /u01/app/oracle/network/admin/tnsnames.ora.If you see the newer wording, read it closely. It often tells you exactly which alias failed and which file Oracle checked, which can save you most of the troubleshooting below.
RalanTech’s Oracle DBAs troubleshoot client connectivity, Oracle Net configuration, and listener issues so your applications get back online fast.
An Oracle connection goes through a few stages. The client resolves the name first. Only after that does it contact the listener on the database server, which then hands the session to the database.
ORA-12154 stops the process at the very first stage. That’s why it’s different from errors such as “no listener” or “service not registered”: with ORA-12154, the network request never leaves the client machine.

Oracle Net resolves connect identifiers through naming methods. The NAMES.DIRECTORY_PATH parameter in the client’s sqlnet.ora file controls which methods are used and in what order. According to the Oracle Net Services Reference, the default order is (tnsnames, ldap, ezconnect).
| Naming method | Value in NAMES.DIRECTORY_PATH | Where the name is looked up | Typical use |
| Local naming | tnsnames | The tnsnames.ora file on the client | Most on-premises clients and servers |
| Directory naming | ldap | A central LDAP directory server | Large estates that manage aliases centrally |
| Easy Connect | ezconnect | No repository: the host, port, and service are in the string itself | Quick connections, scripts, and modern apps |
| External naming | nis | A Network Information Service | Rare, older UNIX environments |
If sqlnet.ora sets NAMES.DIRECTORY_PATH=(tnsnames) only, an Easy Connect string won’t work. If it lists (ezconnect) only, every tnsnames alias will fail with ORA-12154. Both mistakes are easy to make when someone copies a sqlnet.ora file from another server.
One more sqlnet.ora setting catches people out: NAMES.DEFAULT_DOMAIN. When it’s set, Oracle appends that domain to any unqualified name. With a default domain of example.com, a connection to sales is searched as sales.example.com. If your tnsnames.ora entry is just sales, the lookup fails.
Many ORA-12154 cases come down to Oracle reading a different tnsnames.ora file than the one you just edited. Oracle’s documentation on net service names and the tnsnames.ora file gives this search order:
TNS_ADMIN environment variable is set, Oracle checks that directory first.ORACLE_HOME/network/admin, or ORACLE_BASE_HOME/network/admin for a read-only Oracle home, falling back to ORACLE_HOME/network/admin if the file isn’t there.On some UNIX platforms, Oracle’s installation guides also list /etc as a location, checked right after TNS_ADMIN. So a machine with two Oracle clients, or a TNS_ADMIN variable set for one user but not another, can easily read the wrong file. The alias exists, just not in the file Oracle is actually using.
Almost every ORA-12154 traces back to one of a handful of causes. This table pairs each one with the clue that points to it.
| Cause | Clue that points to it | Fix |
| The alias is misspelled or missing | Other aliases in the same file work | Correct the name in the connection string or add the entry |
| Oracle is reading a different tnsnames.ora | The alias is in the file you edited, but tnsping can’t resolve it | Set TNS_ADMIN, or edit the file Oracle actually uses |
| Syntax error in tnsnames.ora | Several aliases fail at once, often after a recent edit | Check for unmatched parentheses, stray characters, and copied “smart” quotes |
| Naming method not enabled | Easy Connect fails but aliases work, or the reverse | Add the method to NAMES.DIRECTORY_PATH in sqlnet.ora |
| NAMES.DEFAULT_DOMAIN mismatch | The fully qualified name works, the short name doesn’t | Match the entry name to the domain, or remove the default domain |
| The application runs with a different environment | SQL*Plus works under your login, the service or scheduled job doesn’t | Set TNS_ADMIN for the service account, app pool, or job runner |
| 32-bit and 64-bit mismatch on Windows | A 32-bit tool fails on a server with only a 64-bit client | Install the client that matches the application’s bitness |
| Special characters in the password | The error appears only for one user whose password contains @ | Enter the password at the prompt instead of on the command line |
The tnsnames.ora syntax issue deserves a special mention. Oracle warns that “errors in a TNSNAMES.ORA file may make it unusable”, so one bad parenthesis in one entry can break aliases elsewhere in the file. If several connections broke at the same time, look at the most recent edit first.
The password issue is less obvious. SQL*Plus treats the text after an @ as the connect identifier, so a password like Pa@ss2026 typed on the command line can be split in the wrong place, leaving Oracle to look up an alias that doesn’t exist. Typing sqlplus scott@sales and entering the password when prompted avoids it.
Work through these checks in order. Each one rules out a cause before you move to the next, so you don’t end up changing files that were never the problem.
sqlplus scott@//dbhost.example.com:1521/salespdb. If this works, the database, listener, and network are fine, and the problem is name resolution.echo $TNS_ADMIN on Linux, echo %TNS_ADMIN% on Windows) and which Oracle client is first on the path (which sqlplus or where sqlplus).tnsping sales. The output shows which parameter files were used and which adapter resolved the alias, and “TNS-03505: Failed to resolve name” confirms the lookup itself is failing.One thing to know about step 4: tnsping only tests whether the listener can be reached. Oracle’s guide to testing connections notes that it “does not actually determine whether the database is running”. It’s also not part of the basic Instant Client packages, so on those machines the Easy Connect test in step 2 is your main tool.
If you’re also unsure which client release is installed, our guide on finding your Oracle database version covers the commands for both the database and the tools around it.
A correct entry gives the alias a name, an address, and the service to connect to. Every opening parenthesis needs a matching closing one:
SALES =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbhost.example.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = salespdb.example.com)
)
)With this entry in the file Oracle reads, sqlplus scott@SALES resolves to dbhost.example.com on port 1521 and asks for the salespdb.example.com service.
Here’s an illustrative case. A nightly export runs under a Windows service account and fails with ORA-12154, while the DBA can run the same export by hand without any errors.
The DBA’s own session has TNS_ADMIN set to a shared folder that holds the company’s tnsnames.ora. The service account doesn’t, so Oracle falls back to the tnsnames.ora inside its own Oracle home, which doesn’t contain the alias. Setting TNS_ADMIN at the system level, rather than only for one user, fixes the job and every other process on that server.
An Oracle health check reviews configuration, connectivity, performance, and security, and flags the small issues that turn into outages.
The causes above apply everywhere, but a few environments add their own twist.
The JDBC Thin driver doesn’t use the Oracle client installation, so it can’t rely on a full client’s default locations. Oracle’s JDBC driver reference lets you point it at the tnsnames.ora directory in two ways: in the URL, or through the oracle.net.tns_admin connection property.
jdbc:oracle:thin:@sales?TNS_ADMIN=/opt/oracle/network/admin
jdbc:oracle:thin:@//dbhost.example.com:1521/salespdb.example.comThe first line resolves the alias from the folder you name. The second skips tnsnames.ora completely by using Easy Connect.
On Windows, an application can only use an Oracle client with the same bitness. Microsoft’s support team notes that a 64-bit SQL Server linked server needs the 64-bit Oracle provider (Microsoft Learn). A 32-bit reporting tool on the same server, meanwhile, needs a 32-bit client. Each client can have its own network/admin folder, so an alias added to one isn’t visible to the other unless both point to a shared TNS_ADMIN.
When a database link fails with ORA-12154, the lookup happens on the database server, not on your workstation. The alias in the link’s USING clause has to exist in the tnsnames.ora that the database server reads. You can also avoid the dependency by putting an Easy Connect string or a full connect descriptor directly in the USING clause.
Connections to Oracle Autonomous Database use a wallet, a zip file with its own tnsnames.ora and sqlnet.ora. Oracle’s steps for connecting from OCI Cloud Shell unzip the wallet, point sqlnet.ora at the wallet directory, and set TNS_ADMIN to that folder. If TNS_ADMIN still points elsewhere, aliases such as mydb_low or mydb_high won’t resolve.
Teams moving workloads to Oracle Cloud Infrastructure often hit this during the first week, when old desktop clients still read the on-premises tnsnames.ora.
Several Oracle connection errors look alike, but each one fails at a different stage. Knowing the stage tells you where to look.
| Error | What it means | Where it fails | Where to look |
| ORA-12154 | The connect identifier can’t be resolved | On the client, before any network call | tnsnames.ora, sqlnet.ora, TNS_ADMIN, LDAP |
| ORA-12541 | No listener at the host and port (Oracle reference) | Reaching the server | Listener status, host name, port, firewall |
| ORA-12514 | The listener doesn’t know the requested service (Oracle reference) | At the listener | Service name, database registration with the listener |
| ORA-12170 | The connection timed out (Oracle reference) | On the network path | Firewalls, routing, network latency |
A useful rule of thumb: if fixing ORA-12154 turns it into ORA-12541 or ORA-12514, you’ve made progress. The name now resolves, and the remaining problem sits further along the connection path.
Most repeat cases come from configuration drift: copies of tnsnames.ora scattered across servers, each slightly different. Four habits keep it under control:
Older client software adds its own risk, because unsupported versions stop getting fixes. Keeping clients current is part of any Oracle database upgrade plan. Where an upgrade isn’t possible yet, Oracle third-party support keeps older environments maintained and secure in the meantime.
For teams without a dedicated DBA, these checks are easy to skip until something breaks. Remote DBA support covers this kind of routine configuration work, alongside monitoring, patching, and incident response.
It means the Oracle client couldn’t translate the connect identifier, such as a tnsnames.ora alias, into a connect descriptor. Because the name never resolved, the client didn’t attempt a network connection.
No. ORA-12154 is raised on the client before the database or the listener is contacted. The database can be fully available while one client fails with this error.
Check the TNS_ADMIN environment variable first, because Oracle searches that directory before the Oracle home. Running tnsping with your alias also shows which parameter files and naming adapter were used.
Yes. Easy Connect lets you use host:port/service_name directly, as long as ezconnect is enabled in NAMES.DIRECTORY_PATH. Oracle notes that Easy Connect is enabled by default and doesn’t need a repository.
The application usually runs with a different environment. It may use another Oracle client, a different bitness, or a service account without TNS_ADMIN set, so it reads a tnsnames.ora that doesn’t contain the alias.
A syntax error, such as a missing parenthesis, can make the whole file unusable. Check the most recent edit first, then compare it with a working entry.
ORA-12154 looks like a database failure, but it’s really a lookup problem on the client. Oracle couldn’t match the name you used with an address, so it never tried to connect.
Start with an Easy Connect test to prove the database is reachable. Then find the tnsnames.ora and sqlnet.ora files that Oracle actually reads, and check the environment of the process that’s failing. In most cases, the fix is a single line in a single file. The harder part is keeping every client pointed at the same, correct configuration, and that’s where a shared TNS_ADMIN and a standard client build pay off.
If you’re still mapping out how Oracle fits together, our overview of how Oracle Database works is a good next read.
Talk to RalanTech’s Oracle experts about stable client configuration, troubleshooting, and 24×7 database support.
Raju Chidambaram is a seasoned technology executive with over 30 years of global leadership in enterprise IT, cloud architecture, and secure data operations. As the Co-Founder and Chief Technology Officer at RalanTech, Raju is the strategic force behind high-performance technology platforms that drive business transformation for Fortune 1000 companies and emerging growth companies. With deep expertise rooted in enterprise data center management and mission-critical database systems, Raju brings unparalleled depth in cloud strategy, database modernization, and multi-cloud migration. He has architected scalable, resilient, and secure data platforms across hybrid and public cloud environments, ensuring performance, compliance, and business continuity for over 200+ enterprise clients.
RalanTech is specialized in database managed services. We are passionate about leveraging cutting-edge solutions to drive innovation, efficiency, and growth for our clients.

Join thousands of professionals who rely on our newsletter for insights that drive real growth. Signup now and stay informed, inspired, and ahead.