Re: Why isn't my script running?

From: Jared Still <jkstill_at_gmail.com>
Date: Tue, 24 Feb 2009 10:43:37 -0800
Message-ID: <bf46380902241043n6ffec00av17f237b3dcec477f_at_mail.gmail.com>



At the very least, you will need to add some lines to the script to setup the oracle environment.

export ORACLE_SID=<your SID here>
export ORAENV_ASK=NO

. /usr/local/bin/oraenv

The dot space in the previous line is intentional. It loads the environment into the current shell.

Also, you don't need a ';' at the end of an exec line.

And, you do not need the '/' either.

Extraneous '/' in a SQL script is always a bad idea, as it will attempt to execute whatever the previous SQL statement was.

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

On Tue, Feb 24, 2009 at 10:15 AM, Eugene Pipko <eugene.pipko_at_unionbay.com>wrote:

> Hi all,
>
> I am new to shell. I need to calculate stats for a schema using cron
> (oracle linux 4).
>
> For some reason my script is not running.
>
> --------------------------------------
>
> #!/bin/ksh
>
> USER=SYSTEM
>
> PASSWORD=pwd
>
> 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 0;
>
> EOF
>
> -------------------
>
>
>
> Then in Linux:
>
> 00 01 * * 7 /home/oraprd/scripts/test_schema_stats.sh 1&2 >>
> /home/oraprd/scripts/logs/test_schema_stats.log
>
>
>
> Thanks,
>
> Eugene Pipko
>
> P Please consider the environment before printing this e-mail.
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 24 2009 - 12:43:37 CST

Original text of this message