i can run sqlldr fine via a perl script or shell script, but when i call the script(s) from a crontab then i get an error telling me that it can find sqlldr. if i type the whole path in the script then i get a different error. any ideas?
so in my scripts this was as about as complicated as i got. this worked fine with the scripts, but when i ran the cron command i got errors. i could not find /usr/bin/coraenv on the box i have this script on. what does it mean?
I think that the problem you are encountering is because jobs submitted through cron do not get the same environment set up for them as when you log in to the server and run them interactively. There are a couple of simple solutions:
1) Run the script from a privileged user and schedule an su command instead of scheduling the script directly. e.g. run the script from the root crontab, as follows:
[schedule_info] su - [oracle_user] -c [name of script] >[log_file] 2>>&1
obviously, in the above, objects enclosed in square braces require your system-specific information inserting in their place.
2) At the start of your script, set up the environment for the script (ORACLE_SID, ORACLE_HOME, any environment variables required in the script - this is what the previously posted script was doing. You *may* be able to achieve this by 'sourcing' your .profile in the first line of the script. ('sourcing' a file is running it within the current shell environment, and is achieved by preceeding the script name with '. ' (dot space)), as below