Using CRON to run sqlplus utilities [message #365381] |
Fri, 10 April 1998 10:45 |
Ken
Messages: 50 Registered: April 1998
|
Member |
|
|
I have 2 sqlplus scripts, UTLB and UTLE, that I would like to have cron submit for me. I would like the UTLB script to run first thing in the morning and the UTLB script to run at the end of the day. I can manually run these from the unix prompt but when I try to get cron to run them nothing happens. Any suggestions on what I should do next? (btw I am using HP-UX 10.1)
Thanks
|
|
|
Re: Using CRON to run sqlplus utilities [message #365382 is a reply to message #365381] |
Fri, 10 April 1998 16:00 |
Manish Thawani
Messages: 6 Registered: April 1998
|
Junior Member |
|
|
Hi ,
I hope this example will help you.
Do a man on crontab if you want to see the syntax.
Also take care of the permisions when trying to execute through cron. The script should have execute permision and right ownership.
Let's say these are the entries in crontab .
# P110 database
45 17 * * 5 /ngbin/tsv/bin/ora_rbs_set.scr > /ngbin/tsv/log/p110_rbs.log
45 21 * * 1 /ngbin/tsv/bin/ora_rbs_set.scr > /ngbin/tsv/log/p110_rbs.log
example of the script ora_rbs_set.scr
!/bin/ksh
# Function:
export ORACLE_SID=p110
export ORACLE_HOME=`awk -F":" '$1~/^p110/ {print $2}' export PATH=$ORACLE_HOME/bin:$PATH
sqlplus -s <<!EOF
system/manager
spool output.log
select *
from DBA_ROLLBACK_SEGS
where
SEGMENT_NAME like 'RBS_0_'
and STATUS in ( 'OFFLINE','AVAILABLE')
;
spool off
exit
!EOF
Here is another example.
00 0 * * * /x/prod/pat/bin/pat_perform2.scr 1>/x/prod/pat/log/perform2.log
2>&1
pat_perform2.scr looks like
ORACLE_SID=pat1
ORACLE_HOME=/sys2/oracle/product/7.3.2
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID ORACLE_HOME PATH
sqlplus username/passwd @/x/prod/pat/sql/fin_svr_stats7.sql
All the best!
Bye!
Manish
|
|
|
|
|