Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crontab doesnt work

Status
Not open for further replies.

tovohery

Technical User
Jul 25, 2006
45
0
0
When i try to create a job with crontab in AIX 5.3, it doesn't work. Does someone may help me.
This is my script in crontab

20 15 * * * sh /home/oracle9i/Import/ferma.sh

The ferma.sh is below

#!/usr/bin/sh
ORACLE_HOME=/data1/oracle/product/9.2.0
export ORACLE_HOME

sqlldr adm/adm control='/home/oracle9i/Import/ferma.ctl' log='/home/oracle9i/Import/ferma.log'

Regards
 
I take it this works interactively if you run it as the oracle user? If so, add the same PATH variable as indicated by echo $PATH to your script, and I'd also include the ORACLE_SID for good measure.

I don't mind people who aren't what they seem. I just wish they'd make their mind up.

Alan Bennett.
 
I run it as an oracle user. My $PATH is like this
# echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle9i/bin:/usr/bin/X11:/sbin:.:/data1/oracle/product/9.2.0/bin

So i'm new in UNIX and in which I add these path in crontab or in the ferma.sh
Note : When i run directly the script sh /home/oracle9i/Import/ferma.sh it works well but no with crontab

Regards
 
Add the following at the start of your script, ferma.sh:

export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle9i/bin:/usr/bin/X11:/sbin:.:/data1/oracle/product/9.2.0/bin

and

export ORACLE_SID=<yoursid>

and give it another go.



I don't mind people who aren't what they seem. I just wish they'd make their mind up.

Alan Bennett.
 
Thanks, it works well.
I want to execute an sql script in the script but it doesn't work yet. So I want to add these lines below in ferma.sh

sqlplus adm/adm
insert into cdc select * from ferma;
commit;

The problemem is that the command sql didn't execute

Regards
 
Try:

print "insert into cdc select * from ferma;
commit;"|sqlplus adm/adm

IBM Certified -- AIX 4.3 Obfuscation
 
Perhaps use the full path to sqlplus too, though this should be obviated by the PATH setting I would think.

I don't mind people who aren't what they seem. I just wish they'd make their mind up.

Alan Bennett.
 
hi,
in which crontab have you put the script:

in the root one or in the oracle user ?

When you try interactively and it goes, which user are you?
I hope you use crontab -e inside this user.
Inside script, redirect output+error in separated files
so you can see errors written on them. See mail of
the user, maby there is some output.

bye
vittorio
 
Thanks for your help. It works well know
The crontab is run inside the oracle user.

Regards
 
I use root's crontab and scripts that go like this:

Code:
su - oracle <<eof_su
sqlplus user/pwd <<eof_sql
select whatever from whichever where thisfield = 'thatvalue';
eof_sql
eof_su


the "su - oracle" provides the complete oracle working env.

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top