Home » RDBMS Server » Server Utilities » Calling SQLLDR using crontab
Calling SQLLDR using crontab [message #233143] Wed, 25 April 2007 00:29 Go to next message
rmkandan
Messages: 6
Registered: April 2007
Junior Member
HI
I am able to execute the SQLLDR command in a shell script successfully.

But, when I call the same script using a Crontab, the job is failing at calling the SQLLDR

SQL*Loader execution encountered a fatal error

Please let me know if I am missing anything in calling the script
The cronjob entry is like below

20 13 * * * /export/home/cm_user/sqlldrscripts/run_exclusion.sh >> /export/home/cm_user/sqlldrscripts/nohup.log & >/dev/null 2>&1

Below is portion of my script :

# do not edit section below

CTRLFILE=user_info.ctl
LOGFILE=import_exclusion.log
DISCARDFILE=import_discard.log
BADFILE=import_badfile.log
CONNECTSTR=local
LOADFILE=import.csv
TODAY=`date +%d%m%y_%H%M%S`
#START=$(date +%s)

$ORACLE_HOME/bin/sqlldr userid = $USERID control = $SCRIPT_HOME/$CTRLFILE data = $LOADFILE log = $LOGFILE discard = $DISCARDFILE bad = $BADFILE errors=0 rows
=1000 direct=true
retval=$?
if [ $retval -ne 0 ]
then
echo "Errors during SQL LOAD"
case "$retval" in
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
else
echo "SQL*Loader execution successful"
#STARTSQL=$(date +%s)
STARTSQL=`date +%d%m%y:%H%M%S`


[Updated on: Wed, 25 April 2007 00:54]

Report message to a moderator

Re: Calling SQLLDR using crontab [message #233171 is a reply to message #233143] Wed, 25 April 2007 01:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
set ORACLE_HOME and other environment variables.
When started from cron, .profile is not read.

Regards
Michel
Re: Calling SQLLDR using crontab [message #233196 is a reply to message #233171] Wed, 25 April 2007 03:14 Go to previous message
rmkandan
Messages: 6
Registered: April 2007
Junior Member
Hi Michel

I have set the env variable in the script before, but I have not used export.

ORACLE_HOME=/usr/oracle/10g
ORACLE_SID=ABC
ORACLE_BASE=/usr/oracle
export ORACLE_HOME
export ORACLE_SID


And now it is wokring !!

Thanks A Lot Michel.

[Updated on: Wed, 25 April 2007 03:30]

Report message to a moderator

Previous Topic: Scheduling an export
Next Topic: How can i import database by using dump file?
Goto Forum:
  


Current Time: Wed Dec 25 12:04:59 CST 2024