It's a rough sketch, but maybe this will be of some help.
Not sure if it will work so please test safely.
There are three files to modify/create:
(1) /etc/crontab
(2) /home/oracle/my_cron_script.bash
(3) /home/oracle/my_cron.sql
(4) /home/oracle/my_cron_script.log
The fourth is a log file produced by the my_cron_script.bash
-unimatrixdoc
#########################################
# FILENAME: /etc/crontab
#########################################
Code:
# Man page for crontab:
# http://ss64.com/bash/crontab.html
# recommend using a user crontab!
# replace user_name with correct user that has rights
06 0 * * * user_name bash /home/oracle/my_cron_script.bash > /home/oracle/my_cron_script.log
#########################################
# FILENAME: /home/oracle/my_cron_script.bash
#########################################
Code:
#!/bin/bash
# Basic info about the ORACLE_HOME environment varible can be found here:
# http://docs.oracle.com/cd/E11882_01/server.112/e16604/qstart.htm#i1055567
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/client_1
# Are you trying to run SILENT? it's capital -S
# http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch3.htm#i1169374
/home/oracle/app/oracle/product/11.2.0/client_1/bin/sqlplus -S /nolog < /home/oracle/my_cron.sql
# sql file syntax can be found here:
# http://ss64.com/ora/syntax-sqlplus.html
# Info about /nolog
# http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch3.htm#sthref628
#########################################
# FILENAME: /home/oracle/my_cron.sql
# NOTE: put a fullpath to
# extract_data.sql location
#########################################
Code:
CONNECT user/user_1234@CBDTEST
@extract_data.sql