I am writing a cron job in Oracle 10g(Linux).
So, i have created a script of inseration a data in a table using a cron tab.
sql script which i created is:
conn / as sysdba
insert into t1(id) values(01);
cron Job script :
10 5 * * * /u01/home/insert.sql
but, when i execute this particular file then data is not getting inserted in that particular table.
SQL script is not shell script. To run any SQL script agains ORACLE database you have to use SQL*Plus. It is cmdline utitlity.
You can run script in this way sqlplus /nolog @/u01/home/insert.sql. But you have to set your PATH environment variable to contraint folder with ORACLE binaries.
On *nix it is $ORACLE_HOME/bin.
For details see documentation.
you cannot insert / as sysdba in your sql script...make a shell script and schedule it......
check belo link and schedule shell script....