cancel
Showing results for 
Search instead for 
Did you mean: 

cron problem

file system
Frequent Advisor

cron problem

I would like to run the cron job


CMD: /oracle/product/bin/sqlplus '/ as sysdba' @vvvv.sql
> oracle 26953 c ±Ý 2¿ù 2 17:45:00 2007
< oracle 26953 c ±Ý 2¿ù 2 17:45:00 2007 rc=1
! could not obtain latest contract from popen(3C)

and have mail about the error.

you have mail in /var/mail/oracle
$ mail
From oracle@iaeisdb Fri Feb 2 17:46:00 2007
Date: Fri, 2 Feb 2007 17:46:00 +0900 (KST)
From: oracle@iaeisdb
Message-Id: <200702020846.l128k0ba026958@iaeisdb>
To: oracle@iaeisdb
Subject: Output from "cron" command
Content-Length: 256

Your "cron" job on iaeisdb
/oracle/product/bin/sqlplus '/ as sysdba' @vvvv.sql

produced the following output:

Error 6 initializing SQL*Plus
Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

how can I erase the error like that?
7 REPLIES
Peter Godron
Honored Contributor

Re: cron problem

Hi,
when you run a script from cron, a minimum environment is created. You have to specify things like $ORACLE_HOME etc, most of the things as in /etc/profile and ~/.profile.

Most people create a shell script with all these definitions in, which also includes the sqlplus statement.
You already recognised this when you added the full path for your sqlplus stsement.

Something like.

#!/usr/bin/sh
ORACLE_HOME=....
ORACLE_SID=...
PATH=...
sqlplus '/ as sysdba' @ww.sql
Oviwan
Honored Contributor

Re: cron problem

Hy

You can source the oracle profile as follows:

$( . /home/oracle/.profile >/dev/null 2>&1; /scripts.sh) >/dev/null 2>&1

or execute it as oracle

su - oracle -c "/script.sh"

Regard
Yogeeraj_1
Honored Contributor

Re: cron problem

Hi,


assuming that you have scheduled the job as the root user, your crontab should look like this:

#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************
45 17 * * * echo "/path/to/your/script/script.sh; exit"|su - oracle 1>/path/to/your/logfiles/output-script.crn 2>/path/to/your/logfiles/error-script.crn

#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************

if otherwise, please define all the environment variables in the script itself.
e.g ORACLE_HOME, ORACLE_SID, PATH etc

hope this helps too!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
file system
Frequent Advisor

Re: cron problem

I have set the parameter ORACLE_HOME,
and I have been running oracle user, the user have already set the parameter .
when it run the scripts.

[iaeisdb:/]> CMD: /oracle/script.sh
> oracle 25489 c ¿ù 2¿ù 5 10:50:00 2007
< oracle 25489 c ¿ù 2¿ù 5 10:50:00 2007 rc=1
! could not obtain latest contract from popen(3C): no such process.

such error are logged at /var/cron/log
.
when root user run the scrpits it runs well but have same log ! could not obtain latest contract from popen(3C): no such process.

when oracle do the script
it dose not run and have erros like
CMD: /oracle/script.sh
> oracle 25489 c ¿ù 2¿ù 5 10:50:00 2007
< oracle 25489 c ¿ù 2¿ù 5 10:50:00 2007 rc=1
! could not obtain latest contract from popen(3C): no such process.

patrik rybar_1
Frequent Advisor

Re: cron problem

hi,

such error message comes from cron, it basicly says that it can't get the contract for what ever process (sometimes long running job which gave output for sendmail and lost contact with mailing daemon)
crontab manpages / contract(4) could say you more i think
anyway, i newer saw this error on hpux, only on solaris

file system
Frequent Advisor

Re: cron problem

when it comes to the error.
i applied to bug patch relative the error.
when i run the script but the error was disappeared.

thank you all.
but I think doubtly that when i run the script with oracle but root it has still error
Error 6 initializing SQL*Plus
Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory


patrik rybar_1
Frequent Advisor

Re: cron problem

if you dont running script as oracle user
you must have set same environments like ora user or owner of oracle software on your machine
oracle_sid, oracle-home, path to ora binaries etc...