Re: unix Ksh script variable

From: De DBA <dedba_at_tpg.com.au>
Date: Wed, 02 Feb 2011 15:40:29 +1000
Message-ID: <4D48EE4D.5010808_at_tpg.com.au>



Have you considered using Oracle Wallets? It takes a bit of effort to setup, but is quite resilient. We have used it for years to great satisfaction. You store just the credential's db_connect_string in a plain-text configuration file, which the script then picks up and uses to connect.

 see e.g.:
http://askdba.org/weblog/2009/09/using-oracle-wallet-to-execute-shell-scriptcron-without-hard-coded-oracle-database-password/

There used to be an Oracle Whitepaper as well which showed how to set this up with the sys account, but I cannot find it any more on the Oracle website. The actual topic of the whitepaper was "Using Oracle Recovery Manager (RMAN) with Database Vault", published in 2006. Basically you just create a credential as demonstrated in the link above and pass the connect string with "as sysdba" as per usual.

Hth,
Tony

A Joshi wrote:
> hi
> I have a script which is to be executed on many databases and different databases have different log in users/password. Login needs to be chosen based on parameter passed so if the parameter passed is 1 it needs to choose user1 and so on. I will be doing sqlplus $usr_at_$DB and need usr to have the value sys in this case and so on
> it is something like -
> user1=sys
> user2=system
> user3=emp
> pw1=x
> pw2=xx
> pw3=xxx
> #number=$1
> number=1
> us=user
> usr=$us$number
> export user1 user2 user3 number us usr
> export pw1 pw2 pw3
> echo $user1
> I tried in below ways but it is not working
> echo $usr
> export $usr ="$user1"
> echo $usr
>
> echo ${!$usr}
> echo ${!usr}
> echo $"$usr"
> echo `echo $"$usr"`
> can someone help.thanks in advance
>
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 01 2011 - 23:40:29 CST

Original text of this message