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: oraenv and cron

Re: oraenv and cron

From: <oratune_at_aol.com>
Date: Thu, 28 Sep 2000 15:52:53 GMT
Message-ID: <8qvpgh$7mc$1@nnrp1.deja.com>

In article <8qvo7m$6hb$1_at_nnrp1.deja.com>,   Joseph T <jthvedt_at_my-deja.com> wrote:
> In article <8qu11j$s29$1_at_nnrp1.deja.com>,
> kal121_at_my-deja.com wrote:
> > All the scripts I run are from Oracle's cron file. Each shell script
> > that runs explicitly sources Oracle's .bash_profile. Your config
 file
> > may be different depending on which shell you are using.
> >
>
> I can't run my usual .profile, since it uses the interactive features
 of
> oraenv to deal with multiple $ORACLE_SIDs. Presumably using oraenv
 with
> ORAENV_ASK=NO is the part of my .profile that I need, but it just
> doesn't work unless I su - oracle.
>
> Oh, and I apologize for the atrocious formatting of the original
> question. Somewhere between deja.com's preview and Netscape 6.2, it
 was
> totally trashed.
>
> > In article <8qtl2j$hqo$1_at_nnrp1.deja.com>,
> > Joseph T <jthvedt_at_my-deja.com> wrote:
> > > Why is it that if I run a shell script containing oraenv from cron
> > > as the
> > > oracle user, it doesn't work; but if I have root run it in cron
> > > with su - oracle -c script_name, it runs?
> [edit]
> --
> Joseph Thvedt
> jthvedt_at_my-deja.com
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

cron does not invoke any shell startup features, such as .profile, .bash_profile. .login, .cshrc, etc., so all the cron job has as far as environment is the default /etc/profile settings. Since you are running an interactive .profile you will want to create a version of that, possibly named .cron_profile, that you can invoke from cron jobs without the interactive components. Yes, this will necessitate multiple .cron_profile files (to deal with the multiple SID's) or you'll need to make the .cron_profile as universal as possible and set the ORACLE_SID value in each cron job.

When you run as root and invoke "su - oracle -c ..." you set the environment for oracle without the interactive commands; the "su - oracle" does this. Unfortunately cron does not work in this manner and you must set the environment in the scripts.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Sep 28 2000 - 10:52:53 CDT

Original text of this message

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