码迷,mamicode.com
首页 > 其他好文 > 详细

一周RMAN备份脚本

时间:2017-07-28 13:27:51      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:mat   com   connect   scripts   备份   recovery   sed   ups   ice   

#! /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_full.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_full.sh #################################
exit;
EOF
echo ‘THE INC BACKUP OF END TIME IS ‘$(date +%Y/%m/%d/%H:%M:%S)

 

一周RMAN备份脚本

标签:mat   com   connect   scripts   备份   recovery   sed   ups   ice   

原文地址:http://www.cnblogs.com/datalife/p/7249635.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!