My Oracle Support Banner

Database Link Accessed Remotely Fails with ORA-12154, Locally Works (Doc ID 1593961.1)

Last updated on SEPTEMBER 08, 2023

Applies to:

Oracle Net Services - Version to [Release 10.2 to 18.1]
Information in this document applies to any platform.


After connecting remotely or via the listener to a source or origin database and then attempting to select across a dblink, the following error occurs:

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

In other words, you establish a connection via the listener, to an instance where a dblink is created. 

Sqlplus <username>/<password>@TNS_alias

Then you issue a select across the dblink like:

SQL>select * from dual@db_link_name;

This yields the ORA-12154 error.

However, when you connect locally to the same origin database, you cannot reproduce this failure using the same link name.

Set ORACLE_SID=<mysid>

Sqlplus <username>/<password>

SQL>select * from dual@db_link_name;
--> works


 This may be a new database link or the $TNS_ADMIN environment variable may have been changed recently.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.