Re: How to retrieve the Connect String in UNIX script?

Hello Tanel,

Thank you for your input.

I would like to clarify my question here.  Yes, I agree that the TWO_TASK 
environment variable can
be set if there is only one database.  However, I have 10 database instances in 
two servers.  I
need to tell the script which database instance should be logon.

The design is:

Put all the User ID and password inside e.g. password.ksh script.  But there 
will be a lot of IF
and CASE statements because the the logon information is determined by the 
Connect String and the
Oracle User ID.

The calling script will call the password.ksh to retrieve the password and 
Oracle user ID.  But I
have problem to retrieve the Connect String unless I have to hardcode in the 
UNIX script e.g.
ORACLE_DATABASE=ABC_SID.

Do we have a better way to handle this hard-coding?

--- Tanel_Põder <tanel.poder.003@xxxxxxx> wrote:

> > If I want to remove the hard-code of the logon information, would you
> > mind to share your experience how to handle this change?  How to set
> > up the UNIX User environment based on the job so that the script can
> retrieve the Connect String
> > easily?
> 
> Set TWO_TASK environment variable in Unix to required connect string (LOCAL
> in Windows). That way your client connects to connect string specified in
> env variable if you don't ask for an excplicit string.
> 
> Also, in your scripts you can check the connect string using sqlplus
> "_connect_identifier" variable or query v$instance...
> 
> 
> SQL> select host_name, instance_name, '&_connect_identifier' conn, user from
> v$instance;
> old   1: select host_name, instance_name, '&_connect_identifier' conn, user
> from v$instance
> new   1: select host_name, instance_name, 'test.world' conn, user from
> v$instance
> 
> HOST_NAME  INSTANCE_NAME    CONN       USER
> ---------- ---------------- ---------- ----------
> PORGAND    test             test.world ADMIN
> 
> Tanel.
> 
> 
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
> 

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: