Database Link fails with ORA-12154 even after setting TNS_ADMIN environment variable
Last updated on SEPTEMBER 06, 2017
Applies to:Oracle Net Services - Version 220.127.116.11 to 18.104.22.168 [Release 9.0.1 to 11.2]
Oracle Net Services - Version 22.214.171.124 to 126.96.36.199 [Release 11.2]
Oracle Net Services - Version 188.8.131.52 to 184.108.40.206 [Release 12.1]
Information in this document applies to any platform.
***Checked for relevance on 16-OCT-2013***
This problem can occur on any platform.
Oracle Server - Enterprise Edition - Version: 8i to 11g
When creating a dblink between two databases, if TNS_ADMIN is not set or set to $ORACLE_HOME/network/admin selecting across the dblink works fine. If setting $TNS_ADMIN to a path different from $ORACLE_HOME/network/admin, select from dblink can fail with:
ORA-12154: TNS:could not resolve the connect identifier specified
The workaround would be to create the dblink with a full connect descriptor instead of a TNS alias.
Here's an example:
create database link DB_TEST connect to SCOTT
identified by "password"
using '(description=(address=(protocol =TCP)
This is likely a new database link or the environment has changed. If $TNS_ADMIN has been set recently, this article may apply.
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