Friday, February 10, 2012

TWO_TASK variable

TWO_TASK variable can be set in OS environment to specify that you can connect to a remote db without specifying a service name. The variable must have a value specified in tnsnames.ora file.


>more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/ora11g/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DB11G =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.74.13)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DB11G)
    )
  )

DB10G =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.74.13)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DB10G)
    )
  )


>
>
>echo $ORACLE_SID
DB11G
>
>export TWO_TASK=DB10G
>
>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 14:22:21 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn username
Enter password:
Connected.

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
DB10G

SQL>
SQL> select name from v$database;


NAME
---------
DB10G

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
>




2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Hi,

      Hope it was clear in the end.

      Thank you,
      Danco

      Delete