YD_顯示RMAN備份資訊及日誌
vi rman_backup_all.sh
#!/bin/ksh
export LANG=en_US
BACKUP_DATE=`date +%d`
RMAN_LOG_FILE=rman_$BACKUP_DATE.out
TODAY=`date`
echo "-----------------$TODAY-------------------">$RMAN_LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME
RMAN=$ORACLE_HOME/bin/rman
export RMAN
ORACLE_SID=BIDB
export ORACLE_SID
ORACLE_USER=oracle
export ORACLE_USER
echo "ORACLE_SID: $ORACLE_SID">>$RMAN_LOG_FILE
echo "ORACLE_HOME:$ORACLE_HOME">>$RMAN_LOG_FILE
echo "ORACLE_USER:$ORACLE_USER">>$RMAN_LOG_FILE
echo "==========================================">>$RMAN_LOG_FILE
echo "BACKUP DATABASE BEGIN......">>$RMAN_LOG_FILE
echo " ">>$RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE
WEEK_DAILY=`date +%a`
case "$WEEK_DAILY" in
"Mon")
BAK_LEVEL=1
;;
"Tue")
BAK_LEVEL=1
;;
"Wed")
BAK_LEVEL=1
;;
"Thu")
BAK_LEVEL=1
;;
"Fri")
BAK_LEVEL=1
;;
"Sat")
BAK_LEVEL=0
;;
"Sun")
BAK_LEVEL=1
;;
"*")
BAK_LEVEL=error
esac
export BAK_LEVEL=$BAK_LEVEL
echo "Today is : $WEEK_DAILY incremental level= $BAK_LEVEL">>$RMAN_LOG_FILE
RUN_STR="
BAK_LEVEL=$BAK_LEVEL
export BAK_LEVEL
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
$RMAN nocatalog TARGET / >>$RMAN_LOG_FILE<<eof
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
backup incremental level= $BAK_LEVEL Database format='/u01/rman_backup/BIDB_lev"$BAK_LEVEL"_%U' tag='BIDB_lev"$BAK_LEVEL"' plus archivelog format='/u01/rman_backup/BIDB_arch_%U' tag='arc_bak' delete all input;
release channel ch2;
release channel ch1;
}
allocate channel for maintenance device type disk;
report obsolete;
delete noprompt obsolete;
crosscheck backup;
delete noprompt expired backup;
crosscheck archivelog all;
delete noprompt expired archivelog all;
release channel;
EOF
"
# Initiate the command string
echo "User Command String: $RUN_STR" >> $RMAN_LOG_FILE
/bin/sh -c "$RUN_STR" >> $RMAN_LOG_FILE
RSTAT=$?
# ---------------------------------------------------------------------------
# Log the completion of this script.
# ---------------------------------------------------------------------------
if [ "$RSTAT" = "0" ]
then
LOGMSG="ended successfully"
else
LOGMSG="ended in error"
fi
echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
cat $RMAN_LOG_FILE|mailx -s "BIDB 192.168.130.24 RMAN Backup " XX@YY.com
exit $RSTAT
[oracle@DB001~]$contron -l
10 1 * * * sh /backup/script/rman_backup_all.sh
</eof
#!/bin/ksh
export LANG=en_US
BACKUP_DATE=`date +%d`
RMAN_LOG_FILE=rman_$BACKUP_DATE.out
TODAY=`date`
echo "-----------------$TODAY-------------------">$RMAN_LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME
RMAN=$ORACLE_HOME/bin/rman
export RMAN
ORACLE_SID=BIDB
export ORACLE_SID
ORACLE_USER=oracle
export ORACLE_USER
echo "ORACLE_SID: $ORACLE_SID">>$RMAN_LOG_FILE
echo "ORACLE_HOME:$ORACLE_HOME">>$RMAN_LOG_FILE
echo "ORACLE_USER:$ORACLE_USER">>$RMAN_LOG_FILE
echo "==========================================">>$RMAN_LOG_FILE
echo "BACKUP DATABASE BEGIN......">>$RMAN_LOG_FILE
echo " ">>$RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE
WEEK_DAILY=`date +%a`
case "$WEEK_DAILY" in
"Mon")
BAK_LEVEL=1
;;
"Tue")
BAK_LEVEL=1
;;
"Wed")
BAK_LEVEL=1
;;
"Thu")
BAK_LEVEL=1
;;
"Fri")
BAK_LEVEL=1
;;
"Sat")
BAK_LEVEL=0
;;
"Sun")
BAK_LEVEL=1
;;
"*")
BAK_LEVEL=error
esac
export BAK_LEVEL=$BAK_LEVEL
echo "Today is : $WEEK_DAILY incremental level= $BAK_LEVEL">>$RMAN_LOG_FILE
RUN_STR="
BAK_LEVEL=$BAK_LEVEL
export BAK_LEVEL
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
$RMAN nocatalog TARGET / >>$RMAN_LOG_FILE<<eof
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
backup incremental level= $BAK_LEVEL Database format='/u01/rman_backup/BIDB_lev"$BAK_LEVEL"_%U' tag='BIDB_lev"$BAK_LEVEL"' plus archivelog format='/u01/rman_backup/BIDB_arch_%U' tag='arc_bak' delete all input;
release channel ch2;
release channel ch1;
}
allocate channel for maintenance device type disk;
report obsolete;
delete noprompt obsolete;
crosscheck backup;
delete noprompt expired backup;
crosscheck archivelog all;
delete noprompt expired archivelog all;
release channel;
EOF
"
# Initiate the command string
echo "User Command String: $RUN_STR" >> $RMAN_LOG_FILE
/bin/sh -c "$RUN_STR" >> $RMAN_LOG_FILE
RSTAT=$?
# ---------------------------------------------------------------------------
# Log the completion of this script.
# ---------------------------------------------------------------------------
if [ "$RSTAT" = "0" ]
then
LOGMSG="ended successfully"
else
LOGMSG="ended in error"
fi
echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
cat $RMAN_LOG_FILE|mailx -s "BIDB 192.168.130.24 RMAN Backup " XX@YY.com
exit $RSTAT
[oracle@DB001~]$contron -l
10 1 * * * sh /backup/script/rman_backup_all.sh
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2128116/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- HQ_顯示RMAN備份資訊及日誌
- RMAN備份歸檔日誌多份 %c
- RMAN備份及恢復歸檔日誌的語法
- RMAN備份歸檔日誌指令碼指令碼
- rman全庫備份備份歸檔日誌檔案
- nginx日誌中顯示cookie資訊NginxCookie
- oracle rman備份歸檔日誌需要先切換日誌嗎Oracle
- rman備份後為什麼要同時備份歸檔日誌
- mysql之 xtrabackup原理、備份日誌分析、備份資訊獲取MySql
- 用RMAN備份歸檔日誌時檢查歸檔日誌是否存在
- RMAN備份整庫和歸檔日誌的方法
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試
- ASM+RMAN使用delete input備份日誌的問題ASMdelete
- 歸檔日誌大小 與使用rman 備份後的歸檔日誌產生的備份集大小的關係
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試(敘)
- 備份之歸檔重做日誌備份
- RMAN備份資料檔案+控制檔案+歸檔日誌
- 備份歸檔日誌
- sqlserver的日誌備份SQLServer
- 請問RMAN備份異機還原,備份之後的歸檔日誌在RMAN中怎麼處理?
- ORACLE RMAN備份及還原Oracle
- Oracle設定多個歸檔路徑生成多份歸檔日誌,Rman備份時也只備份其中的一份歸檔日誌Oracle
- Oracle備份及備份策略及基於Linux下 Oracle 備份策略(RMAN)OracleLinux
- oracle rman不能自動刪除歸檔日誌備份解決Oracle
- RMAN備份恢復之歸檔日誌對BLOCKRECOVER的影響BloC
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份歸檔重做日誌GUIIDE資料庫
- 使用RMAN從相關的備份集、RMAN備份產生的日誌等獲取DBID的二種方法
- oracle備份把日誌錯Oracle
- 日誌傳送事務日誌備份設定
- RMAN筆記之查詢rman備份資訊狀態筆記
- Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)Oracle
- oracle rman備份及策略設定Oracle
- Backup And Recovery User's Guide-使用RMAN備份歸檔重做日誌GUIIDE
- 如何用rman備份不是預設目錄下的歸檔日誌,
- Backup And Recovery User's Guide-從RMAN開始-RMAN操作報表-列表顯示備份GUIIDE
- 備份歸檔日誌檔案
- oracle聯機熱備份的原理,及rman增量備份原理Oracle
- Oracle聯機熱備份的原理及rman增量備份原理Oracle