OK I managed to get those scripts working, however when I schedule via cron I get permission error -
although the cron is from oracle and the script has oracle ownership. It was scheduled to run at 4am
this morning and this is the error I get from var/log/messages.1 and cron.1
[oracle@ukedxdtmtdbs01a log]$ pwd
/var/log
[oracle@ukedxdtmtdbs01a log]$ more messages.1
messages.1: Permission denied
[oracle@ukedxdtmtdbs01a log]$ more cron.1
cron.1: Permission denied
[oracle@ukedxdtmtdbs01a log]$ crontab -l
#! Automatic scheduling of RMAN Backups -- June 2011
00 4 1 * * /u01/app/oracle/product/11.2.0/db_1/sysman/admin/scripts/backup_monthly.sh
00 4 * * 0 /u01/app/oracle/product/11.2.0/db_1/sysman/admin/scripts/backup_weekly.sh
00 4 * * 1-5 /u01/app/oracle/product/11.2.0/db_1/sysman/admin/scripts/backup_daily.sh
this is the actual script - which when run interactively from the oracle account works perfectly
[oracle@ukedxdtmtdbs01a scripts]$
more backup_weekly.sh
#!/bin/ksh
#! Weekly Backup for Test Environment - Perform backup compressed
export ORACLE_SID=DCTMTEST1
mkdir /u01/backups/DCTMTEST_rman_backups_weekly
rman target / catalog rman/DCTM-rman@DCTMTEST log=/u01/backups/DCTMTEST_rman_backups_weekly/DCTMTEST_rman_backups_weekly.log<< EOF
RUN {
ALLOCATE CHANNEL ch1 TYPE
DISK FORMAT '/u01/backups/DCTMTEST_rman_backups_weekly/%d_DB_%u_%s_%p';
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG Tag = 'Weekly Test Backup';
RELEASE CHANNEL ch1;
}
EOF
# Mail log file to the Oracle DBA
mail -s 'RMAN Weekly Backup Log for Test'
name@company.com < /u01/backups/DCTMTEST_rman_backups_weekly/DCTMTEST_rman_backups_weekly.log
Is there something I need to include in the script, prior to executing the RMAN commands to get this script to run successfully?