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

Home -> Community -> Usenet -> c.d.o.server -> Re: shell script lesson needed regarding oraenv script

Re: shell script lesson needed regarding oraenv script

From: Ed Stevens <nospam_at_noway.nohow>
Date: Fri, 19 Nov 2004 07:27:39 -0600
Message-ID: <b4trp0dom10kuk05hj3hvs4j6u1gk91pb4@4ax.com>


On Thu, 18 Nov 2004 21:58:05 GMT, "Dave" <x_at_x.com> wrote:

>
>"Ed Stevens" <nospam_at_noway.nohow> wrote in message
>news:5b2qp0d2m4loa4ulhjsidktf5tk24k9lnc_at_4ax.com...
>> Platform: Oracle 9.2 on Solaris 9
>>
>> One group of servers I inherited had the db's built by the
>> installation procedure of a package product. The install was pretty
>> much textbook OFA, and included some useful scripts that I'm studying
>> for the possibility of using them on other setups not related to the
>> product.
>>
>> In oracle's .profile, they placed a set of functions to select the
>> $ORACLE_SID from a list derived from the oratab file. It actually
>> calls the oraenv script (with ORAENV_ASK=NO) then also sets
>> LD_LIBRARY_PATH and LD_LIBRARY_PATH_64 and some app specific stuff.
>> Rather than accepting free-form input, it presents the list of sids
>> and gets its input using a 'select' statement, forcing you to make a
>> valid choice. A nice touch, I thought.
>>
>> Since I had never used oraenv, I started studying the code and playing
>> around with it. I'll not quote the oraenv script since everyone has
>> access to it on their systems, but here is some screen output of my
>> expriments.... notice that the value of ORACLE_SID never changes.
>> This is my own command line use of oraenv. When invoked by the
>> function provided by the vendor, all is well with the world.
>>
>> === begin transcript ===
>> oracle:cat /var/opt/oracle/oratab
>> #
>> <snip a bunch of comment lines
>> #
>> *:/u01/app/oracle/product/9.2.0:N
>> CMDM1240:/u01/app/oracle/product/9.2.0:Y
>> CMQM1240:/u01/app/oracle/product/9.2.0:Y
>>
>> oracle:echo $ORACLE_SID
>>
>> < note it is not set at this point >
>>
>> oracle:echo $ORAENV_ASK
>> YES
>>
>> oracle:oraenv
>> ORACLE_SID = [oracle] ?
>> ORACLE_HOME = [/local/home/oracle] ?
>>
>> oracle:echo $ORACLE_SID
>>
>> <still not set!>
>>
>> oracle:oraenv
>> ORACLE_SID = [oracle] ? CMDM1240
>> oracle:echo $ORACLE_SID
>>
>> <still not set!>
>> === end transcript ===
>>
>>
>
>you need to do . oraenv, without the dot the change isnt permanent.
>
>watch out for copyright on those scripts as well
>

Sure enough! And after looking at the original script more closely, I see that they called oraenv with the leading dot. Back to "Learning the Korn Shell" for more study. Thanks for the tip. Received on Fri Nov 19 2004 - 07:27:39 CST

Original text of this message

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