-bash-4.1$ export TNS_ADMIN="/tmp/PKI/DB_A"
-bash-4.1$ sqlplus /@DB_A
Connects fine
-bash-4.1$ export TNS_ADMIN="/tmp/PKI/DB_B"
-bash-4.1$ sqlplus /@DB_B
Connects fine
-bash-4.1$ sqlplus /@DB_A
Error logon denied (since the last TNS_ADMIN path points to the DB_A)
There is an option of using TNS Names with the JDBC, i.e. set the oracle.net.TNS_ADMIN property to the directory that contains your tnsnames.ora file ( java -Doracle.net.tns_admin=$ORACLE_HOME/network/admin).
The situation is, I will not be able to change TNS_ADMIN Path. Is there any option in Oracle sqlplus NOT to specify TNS_ADMIN path but seemlessly connect to both DB_A and DB_B ?
You can connect directly to DB like this:
i.e. copy the full text from the
tnsnames.ora
file you like to use. Remove any line breaks for use on command line.