RE: Why isn't my script running?

From: Bobak, Mark <Mark.Bobak_at_proquest.com>
Date: Wed, 25 Feb 2009 15:13:25 -0500
Message-ID: <6AFC12B9BFCDEA45B7274C534738067F0D69EF1A_at_AAPQMAILBX02V.proque.st>



Fair enough, no offense meant....

The most important thing to do, whatever you do, is stick to it and be consistent!

Otherwise, you'll be in a world of hurt when you start moving/upgrading databases and oracle homes.... :-)

-----Original Message-----
From: Sais, Gene [mailto:Gsais_at_mypalmbeachclerk.com] Sent: Wednesday, February 25, 2009 3:12 PM To: Bobak, Mark; 'eugene.pipko_at_unionbay.com'; 'Daniel Fink' Cc: 'oracle-l_at_freelists.org'
Subject: RE: Why isn't my script running?

Nope, didn't miss it. I just choose not to use oraenv and oratab for that matter, since v7.3 I create my own common environment script that gets called by all other scripts. We all have our own way :-)

-----Original Message-----
From: Bobak, Mark [mailto:Mark.Bobak_at_proquest.com] Sent: Wednesday, February 25, 2009 3:04 PM To: Sais, Gene; 'eugene.pipko_at_unionbay.com'; 'Daniel Fink' Cc: 'oracle-l_at_freelists.org'
Subject: RE: Why isn't my script running?

You must have missed the part where we just got done arguing for, and extolling the virtues of, running oraenv.....

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sais, Gene Sent: Wednesday, February 25, 2009 3:00 PM To: 'eugene.pipko_at_unionbay.com'; 'Daniel Fink' Cc: 'oracle-l_at_freelists.org'
Subject: RE: Why isn't my script running?

export ORACLE_HOME=<OH>

You do not need oraenv, just create an environment script that sets all your variables and call it from every script you write. I have a common env script for OH and 1 for each SID. I call both from each script. Do not put stuff in your profile.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Eugene Pipko Sent: Wednesday, February 25, 2009 2:34 PM To: 'Daniel Fink'
Cc: 'oracle-l_at_freelists.org'
Subject: RE: Why isn't my script running?

Thanks for the tip, however when I try it, I get:

/home/oraprd/scripts/spi_schema_stats.sh[12]: .: oraenv: not found

#!/bin/ksh
USER=SYSTEM
PASSWORD=test
export ORACLE_SID=SPIPRD
export ORAENV_ASK=NO
. oraenv

sqlplus -s $USER/$PASSWORD <<EOF
set feed off
set head off
set pagesize 0
exec dbms_stats.gather_schema_stats('TEST',ESTIMATE_PERCENT=>30,CASCADE=>TRUE) exit;
EOF Eugene Pipko
  Please consider the environment before printing this e-mail.

-----Original Message-----
From: Daniel Fink [mailto:daniel.fink_at_optimaldba.com] Sent: Wednesday, February 25, 2009 11:25 AM To: Eugene Pipko
Cc: 'oracle-l_at_freelists.org'
Subject: Re: Why isn't my script running?

You should use . oraenv as Mark suggested. By hard coding the ORACLE_HOME, you run the risk of breaking the script when you upgrade Oracle and/or move to a new ORACLE_HOME.

If you use oraenv, you have a tremendous amount of flexibility in scripting. Maintain your oratab and you don't worry about changing ORACLE_HOMEs and the same script can be used for multiple databases (pass in the ORACLE_SID as a parameter).

If you aren't going to use oraenv, you can remove the ORAENV_ASK line...

Regards,
Daniel Fink

--
Daniel Fink

OptimalDBA.com - Oracle Performance, Diagnosis, Data Recovery and Training

OptimalDBA http://www.optimaldba.com Oracle Blog http://optimaldba.blogspot.com

Lost Data? http://www.ora600.be/

Eugene Pipko wrote:
> Thank you,
> I exported $ORACLE_HOME and it worked:
>
> #!/bin/ksh
> USER=SYSTEM
> PASSWORD=test
> export ORACLE_HOME=/prod/oraprd/product/9.2.0
> export ORACLE_SID=SPIPRD
> export ORAENV_ASK=NO
>
> $ORACLE_HOME/bin/sqlplus -s $USER/$PASSWORD <<EOF
> set feed off
> set head off
> set pagesize 0
> exec dbms_stats.gather_schema_stats('TEST',ESTIMATE_PERCENT=>30,CASCADE=>TRUE)
> exit;
> EOF
>
> Eugene Pipko
>  Please consider the environment before printing this e-mail.
>
>
> -----Original Message-----
> From: Bobak, Mark [mailto:Mark.Bobak_at_proquest.com]
> Sent: Wednesday, February 25, 2009 10:34 AM
> To: Eugene Pipko; 'Mercadante, Thomas F (LABOR)'
> Cc: 'oracle-l_at_freelists.org'
> Subject: RE: Why isn't my script running?
>
> Well, there you go, sqlplus not found.
>
> That means PATH was not modified to contain $ORACLE_HOME/bin.
>
> Most likely cause is that you didn't run '. oraenv'.
>
> A quick look at your script, and sure enough, you set:
> export ORACLE_SID=SPIPRD
> export ORAENV_ASK=NO
>
> But you neglect to actually call '. oraenv' to setup the correct environment.
>
> Try adding:
> . oraenv
>
> immediately following:
> export ORAENV_ASK=NO
>
> in your script.
>
>
> That ought to do it,
>
> -Mark
>

��i��0���zX���+��n��{�+i�^ !���
0~���+-����
������rW�
i0zX+n{+i^ Received on Wed Feb 25 2009 - 14:13:25 CST

Original text of this message