Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need Help...
"Mamun Shaheed" <ovimani_at_hotmail.com> a écrit dans le message news:
5991bf08.0311280204.63c38e98_at_posting.google.com...
> Hi Kenneth,
> I am new commer in Linux+Oracle environment. As you suggested, if I
> put all oracle releated veriable like
> ORACLE_HOME, ORACLE_BASE, ORACLE_SID
> in my script, will it work??
>
> Can you please provide me any example.
>
> ~M$
>
> Kenneth Koenraadt wrote in message
news:<3fc66155.2641498_at_news.inet.tele.dk>...
> > Hi Mamun,
> >
> > when executing its jobs, cron only sets some very basic environment
> > variables, among which are neither ORACLE_HOME or TERM. You need to
> > set them in your script or (better) put them into a separate script
> > and call the script from within your script below like :
> >
> > ". my_script_containing_env_variables.sh"
> >
> > - Kenneth Koenraadt
> >
> > On 27 Nov 2003 09:07:57 -0800, ovimani_at_hotmail.com (Mamun Shaheed)
> > wrote:
> >
> > >Hi, I am running oracle9i on Linux 7.3.
> > >I have a script file running as cron job. the file is as follows
> > >
> > >==========
> > >#!/bin/sh
> > >clear
> > >LOGFILE="log_`date +%Y%m%d`"
> > >
> > >if [ ! -e /u08/Scripts/anomalies/$LOGFILE ] ; then
> > > touch /u08/Scripts/anomalies/$LOGFILE
> > >fi
> > >echo "*Anomalies in Database on `date +%D`*" >>
/u08/Scripts/anomalies/$LOGFILE
> > >
> > >/u01/app/oracle/product/9.2.0/bin/sqlplus -s sa/ora123 << EOF_XTBL
> > >
> > >spool /u08/Scripts/anomalies/output.log
> > >
> > >select ani, custservice.modifieduserid
> > >from custservice
> > >where not exists (select 'x' from cust where
cust.custid=custservice.custid)
> > >and serviceid=1
> > >and (ani like '0%' and length(ani)=9);
> > >
> > >spool off;
> > >
> > >
> > >!echo "<<--Custservice without Customer-->>" >>
/u08/Scripts/anomalies/$LOGFILE
Hi Mamun
You can explicitly give value to your variables in that script
but the best way is to 'source' your init script containing your
environnement.
Why ?
-first reason : scalability/maintenance . If one variable changes, it's
easier to change it at *one* place
-second reason : it's a good coding practice to use such a mechanism.
-third : cron doesn't set the environment variables
I suggest that you read a good book about Shell, use the man pages and post
to UNIX/Linux related groups
to find answers (book+practice seem to be the best)
Cheers,
Alkos
Received on Fri Nov 28 2003 - 09:35:31 CST