Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Sql Loader is giving fatal error message when I try to invoke from crontab

SOLVED
Go to solution
Praveen Kumar BOJJA
Occasional Contributor

Sql Loader is giving fatal error message when I try to invoke from crontab

I am invoking a shell file from cron job in that I am calling sqlloader.Below is the message I am getting when I invoke through cron job.


SQL*LOADER EXECUTION ENCOUNTERED A FATAL ERROR.
This is the error message I am getting when I am calling from Cronjob.

Below is the command that we are using to call sql loader

/app/oracle901/oracleapp/bin/sqlldr USERID=$UID/$PD@$DBNAME
CONTROL=$CONTROL_FILE DATA=/nbs/sql-data/$PTLFL_FILE.dat
log=/nbs/sql-data/ptlflog.log direct=TRUE
RETCODE=`echo $?`
case "$RETCODE" in
0) echo "SQL*LOADER EXECUTION SUCCESSFUL" ;;
1) echo "SQL*LOADER EXECUTION EXITED WITH EX_FAIL, SEE LOGFILE" ;;
2) echo "SQL*LOADER EXECTUION EXITED WITH EX_WARN, SEE LOGFILE" ;;
3) echo "SQL*LOADER EXECUTION ENCOUNTERED A FATAL ERROR" ;;
*) echo "UNKNOWN RETURN CODE";;
esac
The same if I execute from / positon also I am able to load the data
successfully.
Remaing all files also have perminssions.(whatever is required)



Attached shell works pretty fine with the same userid if I execute manually from the root location.And it does not need any profile settings also as I am calling every thing through full path.

5 REPLIES
Andreas D. Skjervold
Honored Contributor
Solution

Re: Sql Loader is giving fatal error message when I try to invoke from crontab

Hi

Try setting your ORACLE_HOME env variable in the beginning of your script.

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Jean-Luc Oudart
Honored Contributor

Re: Sql Loader is giving fatal error message when I try to invoke from crontab

Hi,

You need to initialise all your environment variables in your cron script.

cf this link
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xbd25eea29889d611abdb0090277a778c,00.html

Jean-Luc
fiat lux
Praveen Kumar BOJJA
Occasional Contributor

Re: Sql Loader is giving fatal error message when I try to invoke from crontab

Andreas D. Skjervold 's reply solved my problem.That is first reply to my question,
I want to full points to him ..I dont know how to assign.
Praveen Kumar BOJJA
Occasional Contributor

Re: Sql Loader is giving fatal error message when I try to invoke from crontab

Andreas D. Skjervold 's reply solved my problem.That is first reply to my question,
I want to give full points to him ..I dont know how to assign.
Steve Post
Trusted Contributor

Re: Sql Loader is giving fatal error message when I try to invoke from crontab

FYI: Your little problem applies to TONS of stuff. If you run "env" from the prompt you will see all of your settings. If you run "env" as a cronjob you'll get a nearly EMPTY response.

So.... whenever I put in a set of cronjobs related to each other, I make a project.env file. I put all of the environment vars in there.
Near the top of all my cronjob script (for the specific project), I put.

#----------
# set env
#----------
. /absolute/path/to/project/projectname.env

Of course third party software could have problems like this too. I had this issue on sybase, unidata, and a thing called redback.
And YOU had the problem with Oracle.

steve