TWO TASK

From Oracle FAQ
Jump to: navigation, search

TWO_TASK (or LOCAL on Windows) is an environment variable used to specifies the default remote Oracle service. Connections will be made to a remote database (via SQL*Net) without specifying a service name (tnsnames.ora entry). It will appear to programs that they connect to a local database, while in fact they are routed to a remote database.

This environment variable is equivalent to the LOCAL registry entry on the Windows platforms. If both ORACLE_SID and TWO_TASK or LOCAL are defined, TWO_TASK or LOCAL takes precedence.

Usage[edit]

Windows:

set LOCAL=oraservice1

Unix/ Linux:

$ export TWO_TASK=oraservice1

or

$ setenv TWO_TASK oraservice1

Where 'oraservice1' is defined in the local TNSNAMES.ORA file or in an Names/LDAP server.

Example[edit]

One would normally connect to a remote database by specifying a service name (connect string). for example:

$ sqlplus scott/tiger@connect_str

By setting TWO_TASK you can omit the connect string (it is implied):

$ TWO_TASK=connect_str; export TWO_TASK
$ sqlplus scott/tiger

Also see[edit]