Oracle 23.26ConnectionLab-verified · 2026-12-02

ORA-12154: Cannot connect to database. Cannot find alias

The database link's USING string is an alias that the server cannot find in tnsnames.ora.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-12154: Cannot connect to database. Cannot find alias ********* in *********.

Jump to a cause

  1. 01DB link created with a tnsnames alias that does not exist on the server
  2. 02Alias written with a domain suffix (.WORLD) that the server does not use

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-12-02 · container image gvenzl/oracle-free:23-slim

ORA-12154 is the classic "TNS:could not resolve the connect identifier specified" error. In Oracle 26ai the text changed to "Cannot connect to database. Cannot find alias ... in ...", and the alias and file name are masked with *********.

This page covers database links: the USING alias does not exist on the database server, or it was written with a domain suffix (.WORLD) the server does not use. Creating the link succeeds; the error only appears the first time you query through it. We reproduced it on Oracle 26ai Free.

FAQ

Why does ORA-12154 now say "Cannot find alias *********"?

That is the 26ai wording of ORA-12154. In our run, the alias and the file name were both shown as *********, so check the link's HOST in user_db_links to see which alias was used.

The DB link was created without error. Why ORA-12154 later?

CREATE DATABASE LINK does not connect. The USING alias was resolved only on the first query through the link, and that is where ORA-12154 appeared.

Can I create a DB link without editing tnsnames.ora?

Yes. We used an EZConnect string host:port/service_name in USING ('localhost:1521/FREEPDB1'), and the link worked with no tnsnames entry.

The alias works from my PC. Why ORA-12154 through the DB link?

A DB link resolves the alias on the database server, not on your PC. In our run, FREEPDB1.WORLD failed on the server while FREEPDB1 worked, so use the name the server knows or an EZConnect string.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0