Re: job in cron

From: Fernando N. de Souza <fnantes_at_gmail.com>
Date: Tue, 4 Aug 2015 10:11:05 -0400
Message-ID: <CAGPSa2NZLWUQaErTRriGuBgHQxHsacmEcz=-rahQtzmk=GBgZw_at_mail.gmail.com>



You should also redirect stderr into the file, and you will be able to see any errors when then happen:

sqlplus / as sysdba _at_sp_used > sp_used.txt 2>&1

fnantes_at_gmail.com

On Tue, Aug 4, 2015 at 8:55 AM, Powell, Mark <mark.powell2_at_hp.com> wrote:

> I suggest you also add a “cd” to the location where sp_user.sql is stored
> and where you want to spool sp_user.txt. Either that or full path the
> script location.
>
>
>
> *From:* oracle-l-bounce_at_freelists.org [mailto:
> oracle-l-bounce_at_freelists.org] *On Behalf Of *Svetoslav Gyurov
> *Sent:* Tuesday, August 04, 2015 8:08 AM
> *To:* Brian.Zelli_at_roswellpark.org
> *Cc:* oracle-l (oracle-l_at_freelists.org)
> *Subject:* Re: job in cron
>
>
>
> Hi Brian,
>
> You need to put something like this at the start of your script to have
> the correct env variables exported:
> export PATH=/u01/app/oracle/product/11.2.0.4/db_1/bin:$PATH
> export ORACLE_SID=name
> ORAENV_ASK=NO
> . /usr/local/bin/oraenv
> ORAENV_ASK=YES
>
> Regards,
>
> Sve
>
>
>
>
>
> On Tue, Aug 4, 2015 at 11:44 AM, Zelli, Brian <Brian.Zelli_at_roswellpark.org>
> wrote:
>
> Ok, I created a short script to run a sql job.
>
>
>
> ORACLE_SID=name;export ORACLE_SID
>
> sqlplus / as sysdba _at_sp_used > sp_used.txt
>
> uuencode sp_used.txt sp_used.txt | mail -t "oracle" myemailaddress
>
>
>
> I cronned the job. It runs fine when I execute it but in cron all I got
> was a blank attachment.
>
> When it is in cron, what userid is it using?
>
>
>
> Brian
>
>
>
>
> This email message may contain legally privileged and/or confidential
> information. If you are not the intended recipient(s), or the employee or
> agent responsible for the delivery of this message to the intended
> recipient(s), you are hereby notified that any disclosure, copying,
> distribution, or use of this email message is prohibited. If you have
> received this message in error, please notify the sender immediately by
> e-mail and delete this email message from your computer. Thank you.
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Aug 04 2015 - 16:11:05 CEST

Original text of this message