一周RMAN备份脚本

#! /bin/bash
#crontab---->00 20 * * 0 su - oracle -c '/scripts/oracle_full_backup.sh'
#crontab---->00 20 * * 1-6 su - oracle -c '/scripts/oracle_inc_backup.sh'
export BACKUP_DIR=/backup
export ORACLE_HOME=/oracle/oracle/product/11.2.0/db_1
#exec >> delarch`date +%y%m%d%H`.log
exec > /backup/rman_orcldb_backup.log
###############################################
$ORACLE_HOME/bin/rman target / <<EOF
########################start script_rman_full.sh #################################
#backup database level=0
run {
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK ;
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK ;
backup as compressed backupset incremental level = 0 database format '$BACKUP_DIR/%d_%T_dbfull_%t_%s_%p';
sql 'alter system archive log current';
release CHANNEL ch00;
release CHANNEL ch01;
}
#backup archivelog
run{
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK CONNECT 'sys/oracle@orcldb1';
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK CONNECT 'sys/oracle@orcldb2';
backup archivelog all format '$BACKUP_DIR/%d_%T_arch_%t_%s_%p' delete all input;
release CHANNEL ch00;
release CHANNEL ch01;
}
#backup controlfile
run{
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK ;
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK ;
backup current controlfile format '$BACKUP_DIR/%d_%T_ctl_%t_%s_%p';
release CHANNEL ch00;
release CHANNEL ch01;
}
delete noprompt obsolete recovery window of 30 days;
##########################end script_rman_full.sh #################################
exit;
EOF
echo '===THE FULL BACKUP OF END TIME IS '$(date +%Y/%m/%d/%H:%M:%S)===

#! /bin/bash
#crontab---->00 20 * * 0 su - oracle -c '/scripts/oracle_full_backup.sh'
#crontab---->00 20 * * 1-6 su - oracle -c '/scripts/oracle_inc_backup.sh'
export BACKUP_DIR=/backup
export ORACLE_HOME=/oracle/oracle/product/11.2.0/db_1
#exec >> delarch`date +%y%m%d%H`.log
exec > /backup/rman_orcldb_backup.log
###############################################
$ORACLE_HOME/bin/rman target / <<EOF
########################start script_rman_inc.sh #################################
#backup database level=1
run {
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK ;
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK ;
backup as compressed backupset incremental level = 1 cumulative database format '$BACKUP_DIR/%d_%T_dbinc_%t_%s_%p';
sql 'alter system archive log current';
release CHANNEL ch00;
release CHANNEL ch01;
}
#backup archivelog
run{
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK CONNECT 'sys/oracle@orcldb1';
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK CONNECT 'sys/oracle@orcldb2';
backup archivelog all format '$BACKUP_DIR/%d_%T_arch_%t_%s_%p' delete all input;
release CHANNEL ch00;
release CHANNEL ch01;
}
#backup controlfile
run{
ALLOCATE CHANNEL ch00 DEVICE TYPE DISK ;
ALLOCATE CHANNEL ch01 DEVICE TYPE DISK ;
backup current controlfile format '$BACKUP_DIR/%d_%T_ctl_%t_%s_%p';
release CHANNEL ch00;
release CHANNEL ch01;
}
##########################end script_rman_inc.sh #################################
exit;
EOF
echo 'THE INC BACKUP OF END TIME IS '$(date +%Y/%m/%d/%H:%M:%S)

上一篇:ABP项目中的使用AutoMapper


下一篇:在eclipse中的tomcat内存设置