Thursday, February 11, 2010

TWO_TASK

TWO_TASK
This UNIX environment variable specify a connection string. Connections that do not specify a database will connect to the database specified in TWO_TASK.

Eg.

TWO_TASK=TEST
export TWO_TASK
sqlplus hr
is the same as:

sqlplus scott@TEST

Take note that this variable will even overwrite $ORACLE_SID and cause ORA-01031: insufficient privileges when you connect as sysdba.

Eg.
SQL> conn / as sysdba
ERROR:
ORA-01031: insufficient privileges

To unset,
sh or ksh:
unset TWO_TASK
csh:
unsetenv TWO_TASK

Eg.
$ unset TWO_TASK
$ sqlplus /nolog
SQL> conn / as sysdba
Connected.