rman 全備份指令碼
#$RMAN_HOME/script/rman_full0.sh
#CONFIGURE RETENTION POLICY TO REDUNDANCY 1; --According to you space
#-----------------------script env-----------------------
. /home/oracle/.bash_profile
RMAN_HOME=/backup/rman #set according to your backup directory
LOGFILE=$RMAN_HOME/log/rman_full0.log
#ONEDAY=`date +%Y%m%d`
ONEDAY=`date +%Y%m%d%H%M`
ONEDAYDIR=$RMAN_HOME/$ONEDAY
ONEDAYDATA=$ONEDAYDIR/data
ONEDAYARCH=$ONEDAYDIR/archlog
ONEDAYCTLF=$ONEDAYDIR/ctlfile
ONEDAYLOG=$ONEDAYDIR/log
ONEDAYSPFILE=$ONEDAYDIR/spfile
#---check ONEDAYDIR, if no then create them---------
if [ ! -d ${ONEDAYDIR} ];
then mkdir ${ONEDAYDIR}
fi
if [ ! -d ${ONEDAYLOG} ];
then mkdir ${ONEDAYLOG}
fi
if [ ! -d ${ONEDAYDATA} ];
then mkdir ${ONEDAYDATA}
fi
if [ ! -d ${ONEDAYARCH} ];
then mkdir ${ONEDAYARCH}
fi
if [ ! -d ${ONEDAYCTLF} ];
then mkdir ${ONEDAYCTLF}
fi
if [ ! -d ${ONEDAYSPFILE} ];
then mkdir ${ONEDAYSPFILE}
fi
#rman backup full database log
LOGDATE=`date +%Y-%m-%d-%H-%M`
RMANLOG=$ONEDAYDIR/log/${LOGDATE}.log
#---check the logfile, if no then create them---------
if [ ! -f ${LOGFILE} ];
then touch ${LOGFILE}
fi
if [ ! -f ${RMANLOG} ];
then touch ${RMANLOG}
fi
#-------------start backup-----------------
echo "-------------------------Rman full backup -------------------------" >> ${LOGFILE}
echo "backup start time:" `date +%Y-%m-%d_%H:%M:%S` >> ${LOGFILE}
echo "----------------------Rman Database backup ------------"`date +%Y-%m-%d_%H:%M:%S` >>${RMANLOG}
$ORACLE_HOME/bin/rman nocatalog target sys/oracle <<EOF >> ${RMANLOG}
run
{
delete noprompt obsolete;
allocate channel c1 type disk MAXPIECESIZE 5g;
allocate channel c2 type disk MAXPIECESIZE 5g;
allocate channel c3 type disk MAXPIECESIZE 5g;
allocate channel c4 type disk MAXPIECESIZE 5g;
backup as compressed backupset incremental level 0 database tag 'full0backup' filesperset 3 format '$ONEDAYDIR/data/db_full0_%T_%d_%t_%s_%p.rbck' include current controlfile;
backup AS COMPRESSED BACKUPSET format '$ONEDAYDIR/archlog/arch_full0_%T_%d_%t_%s_%p.rbck' archivelog all;
delete noprompt archivelog all completed before 'sysdate-15';
backup current controlfile format '$ONEDAYDIR/ctlfile/ctl_%d_%T_%s_%p_%t.rbck';
backup spfile format='$ONEDAYDIR/spfile/spfile_%d_%I_%U_%T.bak' tag='bk_spfile';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
exit;
EOF
echo "backup finish! check in :" ${RMANLOG} >> ${LOGFILE}
echo "backup end time:" `date +%Y-%m-%d_%H:%M:%S` >> ${LOGFILE}
echo "-------------------------------end-----------------------------------" >> ${LOGFILE}
#end of file
cat celar_arch.sh
#!/bin/sh
. /home/oracle/.bash_profile
export BACK_DATE=`date +%Y%m%d`
export BACKUP_PATH=/home/oracle/clear_arch
echo `mkdir -p ${BACKUP_PATH}/log/${BACK_DATE}`
$ORACLE_HOME/bin/rman msglog=$BACKUP_PATH/log/${BACK_DATE}/clear_arch_$BACK_DATE.log << EOF
connect target /;
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog until time 'sysdate-15';
exit;
EOF
#CONFIGURE RETENTION POLICY TO REDUNDANCY 1; --According to you space
#-----------------------script env-----------------------
. /home/oracle/.bash_profile
RMAN_HOME=/backup/rman #set according to your backup directory
LOGFILE=$RMAN_HOME/log/rman_full0.log
#ONEDAY=`date +%Y%m%d`
ONEDAY=`date +%Y%m%d%H%M`
ONEDAYDIR=$RMAN_HOME/$ONEDAY
ONEDAYDATA=$ONEDAYDIR/data
ONEDAYARCH=$ONEDAYDIR/archlog
ONEDAYCTLF=$ONEDAYDIR/ctlfile
ONEDAYLOG=$ONEDAYDIR/log
ONEDAYSPFILE=$ONEDAYDIR/spfile
#---check ONEDAYDIR, if no then create them---------
if [ ! -d ${ONEDAYDIR} ];
then mkdir ${ONEDAYDIR}
fi
if [ ! -d ${ONEDAYLOG} ];
then mkdir ${ONEDAYLOG}
fi
if [ ! -d ${ONEDAYDATA} ];
then mkdir ${ONEDAYDATA}
fi
if [ ! -d ${ONEDAYARCH} ];
then mkdir ${ONEDAYARCH}
fi
if [ ! -d ${ONEDAYCTLF} ];
then mkdir ${ONEDAYCTLF}
fi
if [ ! -d ${ONEDAYSPFILE} ];
then mkdir ${ONEDAYSPFILE}
fi
#rman backup full database log
LOGDATE=`date +%Y-%m-%d-%H-%M`
RMANLOG=$ONEDAYDIR/log/${LOGDATE}.log
#---check the logfile, if no then create them---------
if [ ! -f ${LOGFILE} ];
then touch ${LOGFILE}
fi
if [ ! -f ${RMANLOG} ];
then touch ${RMANLOG}
fi
#-------------start backup-----------------
echo "-------------------------Rman full backup -------------------------" >> ${LOGFILE}
echo "backup start time:" `date +%Y-%m-%d_%H:%M:%S` >> ${LOGFILE}
echo "----------------------Rman Database backup ------------"`date +%Y-%m-%d_%H:%M:%S` >>${RMANLOG}
$ORACLE_HOME/bin/rman nocatalog target sys/oracle <<EOF >> ${RMANLOG}
run
{
delete noprompt obsolete;
allocate channel c1 type disk MAXPIECESIZE 5g;
allocate channel c2 type disk MAXPIECESIZE 5g;
allocate channel c3 type disk MAXPIECESIZE 5g;
allocate channel c4 type disk MAXPIECESIZE 5g;
backup as compressed backupset incremental level 0 database tag 'full0backup' filesperset 3 format '$ONEDAYDIR/data/db_full0_%T_%d_%t_%s_%p.rbck' include current controlfile;
backup AS COMPRESSED BACKUPSET format '$ONEDAYDIR/archlog/arch_full0_%T_%d_%t_%s_%p.rbck' archivelog all;
delete noprompt archivelog all completed before 'sysdate-15';
backup current controlfile format '$ONEDAYDIR/ctlfile/ctl_%d_%T_%s_%p_%t.rbck';
backup spfile format='$ONEDAYDIR/spfile/spfile_%d_%I_%U_%T.bak' tag='bk_spfile';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
exit;
EOF
echo "backup finish! check in :" ${RMANLOG} >> ${LOGFILE}
echo "backup end time:" `date +%Y-%m-%d_%H:%M:%S` >> ${LOGFILE}
echo "-------------------------------end-----------------------------------" >> ${LOGFILE}
#end of file
cat celar_arch.sh
#!/bin/sh
. /home/oracle/.bash_profile
export BACK_DATE=`date +%Y%m%d`
export BACKUP_PATH=/home/oracle/clear_arch
echo `mkdir -p ${BACKUP_PATH}/log/${BACK_DATE}`
$ORACLE_HOME/bin/rman msglog=$BACKUP_PATH/log/${BACK_DATE}/clear_arch_$BACK_DATE.log << EOF
connect target /;
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog until time 'sysdate-15';
exit;
EOF
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-2139807/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN全庫備份指令碼指令碼
- RMAN定時全備份指令碼指令碼
- rman 備份指令碼指令碼
- rman備份指令碼指令碼
- rman備份和增量備份指令碼指令碼
- rman增量備份指令碼指令碼
- windows rman備份指令碼Windows指令碼
- RMAN常用備份指令碼指令碼
- oracle RMAN備份指令碼Oracle指令碼
- [Oracle] rman備份指令碼(2)Oracle指令碼
- 使用rman備份的指令碼指令碼
- oracle rman備份指令碼收集Oracle指令碼
- Windows下RMAN備份指令碼Windows指令碼
- RMAN備份Shel指令碼示例指令碼
- Rman備份的shell指令碼指令碼
- Linux 平臺下 RMAN 全備 和 增量備份 shell 指令碼Linux指令碼
- WINDOWS下 部署 rman 全備指令碼Windows指令碼
- rman的全備份指令碼和控制檔案安全策略指令碼
- 【RMAN】RMAN指令碼中使用替換變數--windows 下rman全備指令碼指令碼變數Windows
- 分享Oracle Rman的備份指令碼Oracle指令碼
- oracle rman 定時備份指令碼Oracle指令碼
- 轉貼:RMAN備份指令碼(Unix)指令碼
- [Oracle] rman備份的指令碼(1)Oracle指令碼
- rman 自動備份指令碼-windows指令碼Windows
- rman備份的shell指令碼(例子)指令碼
- ORACLE RMAN備份的指令碼配置Oracle指令碼
- rman 備份 全庫
- RAC模式下的備份策略以及RMAN備份指令碼模式指令碼
- 資料庫全備份指令碼資料庫指令碼
- rman的備份檢視的指令碼指令碼
- linux 下RMAN備份shell指令碼Linux指令碼
- oracle11g Rman 備份指令碼Oracle指令碼
- RMAN備份歸檔日誌指令碼指令碼
- windows下rman自動備份指令碼Windows指令碼
- RMAN備份恢復測試指令碼指令碼
- 【RMAN】RMAN備份恢復3 RMAN增量備份指令碼與crontab計劃任務指令碼
- RAC模式下的備份策略以及RMAN備份指令碼(轉)模式指令碼
- RAC模式下的備份策略以及RMAN備份指令碼(ZF)模式指令碼