ORA-12154: TNS:could not resolve the connect identifier specified
The client could not turn the connection name you used into an address. The alias is not in the tnsnames.ora the client is reading, or the client is reading a different file than you think. Fix the alias or connect with host:port/service directly.
What it means
This error happens on the client before any network call. A connect identifier such as PROD must be resolved — usually through tnsnames.ora — into host, port and service. ORA-12154 means that lookup failed. The database and listener are not involved yet.
Common causes
- The alias is missing or misspelled in
tnsnames.ora. - The client reads a different
tnsnames.ora(another Oracle home, orTNS_ADMINpoints elsewhere). - A syntax error in
tnsnames.ora(a missing parenthesis breaks the entries after it). sqlnet.oralimits naming methods (NAMES.DIRECTORY_PATH) or adds a default domain.
How to fix it
- Check which file is used: the
TNS_ADMINenvironment variable, else the Oracle home’snetwork/adminfolder. - Look for the alias in that file and check its parentheses.
- Bypass the lookup with Easy Connect:
host:1521/service_name. - In SQLlightspeed you can connect with host, port and service directly, or point the connection to the tnsnames.ora path you want.
Example
Easy Connect needs no tnsnames.ora:
sqlplus app_user@//db-host.example.com:1521/ORCLPDB1
A minimal tnsnames.ora entry:
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db-host.example.com)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = ORCLPDB1)))
In SQLlightspeed
When a statement fails, SQLlightspeed’s error panel shows the error code with a plain-language explanation and a suggestion for what to do next, together with Oracle’s own message and a link to Oracle’s documentation — for this error and dozens of other common ones.
Related errors
ORA-12514ORA-01017ORA-00942 All Oracle errors →
Oracle documentation for ORA-12154. Oracle is a registered trademark of Oracle Corporation. SQLlightspeed is not affiliated with Oracle.