Home>Question Details



Vishal -- Thanks for the question regarding "what is TWO_TASK", version

Submitted on 2-May-2000 13:20 Central time zone
Last updated 27-Jul-2007 8:25

You Asked

what is the use of TWO_TASK environment variable ? 
where can we use it ?

 

and we said...


If you are in a Unix environment, you can normally set 2 environment variables:

ORACLE_HOME
ORACLE_SID

that will connect you to a local database identified by that home and sid.  If you wanted 
to be able to connect to a remote database or a database on that machine via SQLNet, you 
can also set:

TWO_TASK = <tnsconnect string>


The setting of TWO_TASK overrides the ORACLE_SID when set.  You will not connecting to a 
local database with two_task but rather using sqlnet to connect to a remote database.

So, instead of:

$ sqlplus scott/tiger@some_db

I can:

$ setenv TWO_TASK some_db
$ sqlplus scott/tiger

and the @some_db is implied.
 

Reviews    
5 stars connect string   December 5, 2003 - 11am Central time zone
Reviewer: Reader 
Tom, In the above example, some_db should have been resolved using tnsnames.ora on the box from 
which we connect to the remote database. Is it correct? Thanks. 


Followup   December 5, 2003 - 11am Central time zone:

yes, the "local machine"

it could come from a variety of sources on that machine

~/.tnsnames.ora
$ORACLE_HOME/network/admin/tnsnames.ora
/var/opt/oracle/tnsnames.ora
$TNS_ADMIN/tnsnames.ora

for example 

5 stars tnsnames_production.serv_name   December 5, 2003 - 4pm Central time zone
Reviewer: mike 
I have inherited:
Sun Solaris, Oracle8174.
Under $ORACLE_HOME/network/admin/
there are tnsnames.ora and the tnsnames_production.server_name. the server_name is another server 
machine. I have found Oracle also uses "tnsnames_production.server_name"
How this could happen? 



Thanks

Mike



 


Followup   December 6, 2003 - 8am Central time zone:

does your tnsnames.ora have an ifile command in it? 

5 stars That's it! thanks!   December 6, 2003 - 10am Central time zone
Reviewer: A reader 


4 stars Why does it not work when ORACLE_HOME is a softlink   March 2, 2007 - 3pm Central time zone
Reviewer: Tommy Petersen from Phillipsburg, New Jersey, USA
When I do set TWO_TASK or ORACLE_SID, they are not used if my directory for ORACLE_HOME is a softlink. I have updated my ORACLE_HOME to use the real directory name and it works.

We run on Sun Solaris.


Followup   March 4, 2007 - 6pm Central time zone:

why does what not work exactly? and what does not work mean?
5 stars Why such obscure name - TWO_TASK   March 5, 2007 - 10am Central time zone
Reviewer: A reader 
Why TWO?
Why Task?

Thanks, Jan

Followup   March 5, 2007 - 2pm Central time zone:

because in days gone by - the 1980's - two tasks (having two tasks working together) just made 'sense'

Just like "modular code" and "subroutine" used to be commonly used... :)
4 stars What does not work?   March 5, 2007 - 11am Central time zone
Reviewer: Tommy Petersen 
Sorry, I should have been more specific.
My export does not work when I set ORACLE_SID and using a softlink as ORACLE_HOME.
I get the following errors:
EXP-00056: ORACLE error 1034 encountered
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory


Followup   March 5, 2007 - 2pm Central time zone:

you have to use the same ORACLE_HOME + ORACLE_SID with export as you used to start the database with.

we generate the key for the shared memory as a function of the oracle_home+oracle_sid


If you used the "soft linked" oracle_home as the oracle_home when you type startup - then it would work (but the real oracle home would not work)
5 stars listener could not resolve SERVICE_NAME   July 26, 2007 - 1am Central time zone
Reviewer: Vikash from India
Hi ,

  When I am trying to connect Oracle using ODBC  I am getting this in listener.log * my app gives 
error .. DB conn failed(Invalid service name)..

(CONNECT_DATA=(SERVICE_NAME=192.168.0.13)(CID=(PROGRAM=cubadmserv.odbc")(HOST=Amit)(USER=root))) * 
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.13)(PORT=34089)) * establish * 192.168.0.13 * 12514
TNS:listener could not resolve SERVICE_NAME given in connect descriptor

Vikash


Followup   July 27, 2007 - 8am Central time zone:

umm, well - the message seems to say it all.


the service name you used in your tnsnames.ora on the client was not able to be resolved on the server - the listener you connected to did know what that service was.


if you have lsnrctl - use it to connect to that listener and list the services.

Write a Review
 


All information and materials provided here are provided "as-is"; Oracle disclaims all express and implied warranties, including, the implied warranties of merchantability or fitness for a particular use. Oracle shall not be liable for any damages, including, direct, indirect, incidental, special or consequential damages for loss of profits, revenue, data or data use, incurred by you or any third party in connection with the use of this information or these materials.

About Oracle | Legal Notices and Terms of Use | Privacy Statement