I have a cronjob scheduled to be executed every morning at 1.25 am. The script suppose to delete the archive logs created in Oracle DB for the previous day. But it is not executing as expected. But when I execute it manually in the command prompt it executes and delete the archive logs as expected. I hope the problem is when the script connecting to RMAN as a cronjob. But I dont know how to solve it pls help me on this. Following are the things I use
The OS is Susei linux
cron is scheduled as below
25 01 * * * /x01/rman_backup/mahesh/logde.sh
Contents in logde.sh
ORACLE_HOME=/x01/oracle/app/oracle/product/11.2.0/db_1
ORACLE_SID=sec
PATH=$ORACLE_HOME/bin:$PATH
/x01/oracle/app/oracle/product/11.2.0/db_1/bin/rman cmdfile=/x01/rman_backup/mahesh /logdelete.rcv
contents in the logdelete.rcv
connect target /
run
{
delete archivelog all completed before 'trunc(sysdate)';
crosscheck archivelog all;
}
exit;