Database Link Accessed Remotely Fails with ORA-12154, Locally Works

(Doc ID 1593961.1)

Last updated on SEPTEMBER 06, 2017

Applies to:

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

Symptoms

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 user/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 user/password

SQL>select * from dual@db_link_name;

Changes

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

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms