LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2013, 11:03 AM   #1
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Rep: Reputation: 30
script error when schedule to run in crontab


below script ran fine with I executed manually, when I scheduled to run within crontab then it ran into errors:

#!/bin/ksh
ORACLE_HOME=/oracle/11g
ORACLE_SID=SID
TS=`date +'%Y%m%d'`
$ORACLE_HOME/bin/expdp ID/Password directory=data_pump_dir dumpfile=exp_${ORACLE_SID}_${TS}.dmp logfile=exp_${ORACLE_SID}_${TS}.log full=y


can someone please tell me what's wrong?

thanks,
 
Old 03-13-2013, 11:18 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,475

Rep: Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424Reputation: 2424
crontab executes scripts without environment settings, probably oracle needs some additional variable....
 
Old 03-13-2013, 12:10 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Can you show us crontab entry and error message? You can either run script as:
Code:
x x x x x /path/to/script.ksh
OR,
Code:
x x x x x "cd /path/to/script; ./script.ksh"
Where x is any value, for which you've scheduled this script.
 
Old 03-13-2013, 04:19 PM   #4
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Original Poster
Rep: Reputation: 30
here is what I have on my crontab

18,15 * * * * tmp/scripts/exp.ksh /tmp/log/exp.log 2>&1


below is the error on the exp.log

UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
 
Old 03-13-2013, 04:51 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
You need to tell the script to export the symbol ORACLE_HOME. You have it defined, but not identified to pass it to applications started. You likely also need to export ORACLE_SID as well.

You might double check the value on ORACLE_SID - what you have for the value is the string "SID", and I thought that had to be the oracle system identification number.... but I haven't used Oracle in 10 years, so I'm not sure about that.
 
Old 03-14-2013, 12:59 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,247

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You need to find where all the ora env vars are set and source that.
 
Old 04-20-2013, 05:13 AM   #7
fredak
Member
 
Registered: Apr 2013
Location: Montgeron near Paris
Distribution: Slackware
Posts: 32

Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
You need to tell the script to export the symbol ORACLE_HOME. You have it defined, but not identified to pass it to applications started. You likely also need to export ORACLE_SID as well.

You might double check the value on ORACLE_SID - what you have for the value is the string "SID", and I thought that had to be the oracle system identification number.... but I haven't used Oracle in 10 years, so I'm not sure about that.
wouldn't it be also necessary to launch with insertion mode ?

. script

(dot blank script)
 
Old 04-20-2013, 07:31 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
Quote:
Originally Posted by fredak View Post
wouldn't it be also necessary to launch with insertion mode ?

. script

(dot blank script)
In this particular case, no. The script is running a backup application (the $ORACLE_HOME/bin/expdp which I believe is an export data... but it could be anything).

In the usual case of an initialization script (defining the exported values only) you would be right. This would be the usual case, in which the actual cron script would look like:

Code:
#!/bin/ksh
. $HOME/.bin/oracle_setup
TS=`date +'%Y%m%d'`
$ORACLE_HOME/bin/expdp ID/Password directory=data_pump_dir dumpfile=exp_${ORACLE_SID}_${TS}.dmp logfile=exp_${ORACLE_SID}_${TS}.log full=y
But that would assume that the job is tied to a single ORACLE_SID and ORACLE_HOME (this one is much more likely). The SID might vary as there could multiple instances...
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to run a crontab schedule hourly jsaravana87 Linux - Server 5 12-01-2011 12:26 PM
crontab - schedule job to run every minute Hi_This_is_Dev Linux - General 18 04-28-2010 01:52 PM
Using Shell Script crontab backup and delete with schedule chamreth Linux - Newbie 7 10-28-2009 07:59 AM
Crontab entry to schedule a script every 14 days senrooy Linux - General 12 06-03-2009 09:54 AM
Using crontab to schedule a script stuball Linux - Server 9 05-19-2009 08:39 AM


All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration