Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to retrieve the Connect String in UNIX script?

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

From: Wes Brooks <wes_brooks_at_yahoo.com>
Date: Sun, 15 Aug 2004 07:01:53 -0700 (PDT)
Message-ID: <20040815140153.40099.qmail@web51001.mail.yahoo.com>


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?

> > 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_at_freelists.org
> 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_at_freelists.org 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
-----------------------------------------------------------------
Received on Sun Aug 15 2004 - 08:57:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US