How to run rman with cron under RHEL3?
511057Oct 20 2006 — edited Oct 24 2006I am exhausted with all my options and knowledge with this. Tried 2 days with all possibilities, but failed. I have a Oracle 10g r2 (10.2.0.2) on a RHEL3 box. I wrote an orabackup.sh file as
rman target sys/pw@backup nocatalog <<EOF
run
{ backup as backupset incremental level 1 cumulative device type disk tag 'Thu_full_bkup%LEVEL_1' database;
recover copy of database;
backup device type disk tag 'Thu_full_bkup%LEVEL_1' archivelog all not backed up;
delete noprompt obsolete device type disk;
}
exit
EOF
I have tried this with cron (crontab) under both oracle and root env with $PATH containing the $ORACLE_HOME/bin as the first. The cron job under the crontab is as
44 17 * * * "/home/oracle/orabackup.sh >> /home/oracle/rmanbk.log 2>&1". And it kept returning with either "RMAN: command not found" or the "/bin/sh: line 1: /home/oracle/orabackup.sh >> /home/oracle/rmanbk.log 2>&1: No such file or directory". I had included su - oracle -c in the either script or cron job with or without quote, but result the same error. Does not matter the cron phrase was /home/oracle or without it. Some sites suggested to enter the #!/bin/sh as the first line of the script, tried that and failed too. So what exact I should phrase both the script and cron to let it run automatically. I could run the script manually under either oracle and root env.