|
|
|
|
|
|
|
Re: ORA-12514: TNS [message #673463 is a reply to message #673455] |
Tue, 20 November 2018 09:43 |
|
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
petar97 wrote on Tue, 20 November 2018 06:57The setting of TWO_TASK overrides the ORACLE_SID.
Of course I have the curiosity to check out what I did
But do you understand how TWO-TASK overrides ORACLE_SID? Your continued struggle with it indicates that you do not, which then indicates that any research you did on that was pretty superficial.
When you try to connect to a database without providing a connection string:
or
sqlplus username/password (ie: sqlplus scott/tiger)
sqlplus will attempt to connect to a local database as specified by the value of ORACLE_SID. TNS is not involved. The listener is not involved. tnsnames.ora is never read.
If you supply a connect string:
then the request will be passed off to tns ... tnsames.ora will be read to find an entry for 'mydb' and that information will be used to route the request, through the network, to the listener. It makes no difference if the target listener happens to be on the same machine as the client; the request still goes through the full network stack.
Now, set the environment variable TWO_TASK. With that set, instead of using ORACLE_SID, sqlplus will treat the value of TWO_TASK as if it had been supplied as the connection string, and tns is again used.
So:
behaves exactly like
set TWO-TASK=mydb
sqlplus scott/tiger
You need to be familiar with how environment variables come to be set on your chosen operating system.
|
|
|