1、數(shù)據(jù)庫全備到硬盤
10年積累的成都網(wǎng)站制作、網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站策劃后付款的網(wǎng)站建設(shè)流程,更有友誼免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
[oracle@centos7 scripts]$ cat rman_backup.sh source /home/oracle/.bash_profile rman target / log=/home/oracle/backup/backupall_rman.log<2、增量備份腳本
0級增量
[oracle@centos7 scripts]$ cat rman_backup_level0.sh source /home/oracle/.bash_profile rman target / log=/home/oracle/backup/backupall_rman.log<1級增量
[oracle@centos7 scripts]$ cat rman_backup_level1.sh source /home/oracle/.bash_profile rman target / log=/home/oracle/backup/backupall_rman.log<注意:1級備份需要在0級備份的基礎(chǔ)上執(zhí)行。
3、支持全備和增量備份
[oracle@centos7 scripts]$ cat db_back_rman.sh ##=========================================================== ## db_bak_rman.sh ## created by Robinson ## 2017/12/15 ## usage: db_bak_rman.sh <$ORACLE_SID> <$BACKUP_LEVEL> ## BACKUP_LEVEL: ## F: full backup ## 0: level 0 ## 1: level 1 ##============================================================ #!/bin/bash # User specific environment and startup programs if [ -f ~/.bash_profile ]; then . ~/.bash_profile fi ORACLE_SID=${1}; export ORACLE_SID RMAN_LEVEL=${2}; export RMAN_LEVEL TIMESTAMP=`date +%Y%m%d%H%M`; export TIMESTAMP DATE=`date +%Y%m%d`; export DATE RMAN_DIR=/u02/database/${ORACLE_SID}/backup/rman; export RMAN_DIR RMAN_DATA=${RMAN_DIR}/${DATE}; export RMAN_DATA #RMAN_LOG=$RMAN_DATA/log; export RMAN_LOG RMAN_LOG=/u02/database/${ORACLE_SID}/backup/rman/log export RMAN_LOG # Check rman level #====================================================================== if [ "$RMAN_LEVEL" == "F" ]; then unset INCR_LVL BACKUP_TYPE=full else INCR_LVL="INCREMENTAL LEVEL ${RMAN_LEVEL}" BACKUP_TYPE=lev${RMAN_LEVEL} fi RMAN_FILE=${RMAN_DATA}/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}; export RMAN_FILE SSH_LOG=${RMAN_LOG}/${ORACLE_SID}_${BACKUP_TYPE}_${TIMESTAMP}.log; export SSH_LOG MAXPIECESIZE=4G; export MAXPIECESIZE #Check RMAN Backup Path #========================================================================= if ! test -d ${RMAN_DATA} then mkdir -p ${RMAN_DATA} fi echo "---------------------------------" >>${SSH_LOG} echo " " >>${SSH_LOG} echo "Rman Begin to Working ........." >>${SSH_LOG} echo "Begin time at:" `date` --`date +%Y%m%d%H%M` >>${SSH_LOG} #Startup rman to backup #============================================================================= $ORACLE_HOME/bin/rman log=${RMAN_FILE}.log <>${SSH_LOG} echo "Rman Stop working @ time:"`date` `date +%Y%m%d%H%M` >>${SSH_LOG} echo >>${SSH_LOG} echo "------------------------" >>${SSH_LOG} echo "------ Disk Space ------" >>${SSH_LOG} df -h >>${SSH_LOG} echo >>${SSH_LOG} if [ $RC -ne "0" ]; then echo "------ error ------" >>${SSH_LOG} else echo "------ no error found during RMAN backup peroid------" >>${SSH_LOG} rm -rf ${RMAN_FILE}.log fi #Remove old backup than 3 days #============================================================================ RMDIR=${RMAN_DIR}/`/bin/date +%Y%m%d -d "3 days ago"`; export RMDIR echo >>${SSH_LOG} echo -e "------Remove old backup than 3 days ------\n" >>${SSH_LOG} if test -d ${RMDIR} then rm -rf ${RMDIR} RC=$? fi echo >>${SSH_LOG} if [ $RC -ne "0" ]; then echo -e "------ Remove old backup exception------ \n" >>${SSH_LOG} else echo -e "------ no error found during remove old backup set peroid------ \n" >>${SSH_LOG} fi exit
本文名稱:rman備份腳本shell版
URL標(biāo)題:http://weahome.cn/article/jjeehj.html