#!/bin/bash

if [ $1 ]
then
backup_level=$1
else
backup_level=0
fi

backup_user=sys
backup_user_pw=oracle

#catalog_user=rman
#catalog_user_pw=rman

log_file=/oracle/admin/$ORACLE_SID/rman_backup.log

echo "Beginning rman backup ...">$log_file
data>>$log_file

rman target $backup_user/$backup_user_pw <<EOF >$log_file
# catalog $catalog_user/$catalog_user_pw@rman
backup incremental level=$backup_level database ;
quit;
EOF
echo "rman backup finished">>$log_file
data>>$log_file