Oracle DG standby刪除歸檔的判斷指令碼
#!/bin/bash
rman_date=`date "+%Y%m%d"`
rman_log="/home/oracle/oracle_sh/rman_bk_delete.log"
arch_num='10'
####Oracle PATH INFO
export ORACLE_SID=fogtestdb
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
####select arch_num which is not recover
value=`sqlplus -S "/ as sysdba" << !
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
select count(1) from v\\$archived_log where applied <> 'YES';
exit
!`
#### if count(1) is less than arch_num,delete archive log, else sent mail to me
if [[ $value -le $arch_num ]]; then
echo '---------------------------------------------------------------------------------------' >> $rman_log
echo 'delete_date is:' >> $rman_log
echo $rman_date >> $rman_log
echo '---------------------------------------------------------------------------------------' >> $rman_log
$ORACLE_HOME/bin/rman target / << EOF >> $rman_log
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate-4';
crosscheck backup;
delete noprompt obsolete;
exit;
EOF
echo "exec rman delete archivelog"
exit 0
else
echo "Oracle DGarchivelog is not recover,please check" | mail -s 'DG ARCH CHECK' **********@mail.com,*********@mail.com
fi
rman_date=`date "+%Y%m%d"`
rman_log="/home/oracle/oracle_sh/rman_bk_delete.log"
arch_num='10'
####Oracle PATH INFO
export ORACLE_SID=fogtestdb
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
####select arch_num which is not recover
value=`sqlplus -S "/ as sysdba" << !
set heading off
set feedback off
set pagesize 0
set verify off
set echo off
select count(1) from v\\$archived_log where applied <> 'YES';
exit
!`
#### if count(1) is less than arch_num,delete archive log, else sent mail to me
if [[ $value -le $arch_num ]]; then
echo '---------------------------------------------------------------------------------------' >> $rman_log
echo 'delete_date is:' >> $rman_log
echo $rman_date >> $rman_log
echo '---------------------------------------------------------------------------------------' >> $rman_log
$ORACLE_HOME/bin/rman target / << EOF >> $rman_log
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate-4';
crosscheck backup;
delete noprompt obsolete;
exit;
EOF
echo "exec rman delete archivelog"
exit 0
else
echo "Oracle DGarchivelog is not recover,please check" | mail -s 'DG ARCH CHECK' **********@mail.com,*********@mail.com
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29320885/viewspace-1768021/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DATAGUARD_standby刪除歸檔日誌的指令碼指令碼
- dg刪除備庫已經應用的歸檔日誌指令碼指令碼
- 定期刪除歸檔檔案的指令碼指令碼
- 物理DG刪除歸檔測試
- 刪除DG歸檔保留5個
- ORACLE NBU調取oracle rman指令碼備份歸檔不自動刪除歸檔Oracle指令碼
- Oracle 11g 自動刪除ASM歸檔檔案指令碼OracleASM指令碼
- 【轉載】Oracle Data Guard 備庫 歸檔檔案 刪除指令碼Oracle指令碼
- ORACLE刪除歸檔Oracle
- RAC 節點2刪除自己的歸檔指令碼指令碼
- 指令碼定期自動刪除ASM下的歸檔檔案指令碼ASM
- DG歸檔自動刪除 & _log_deletion_policy
- rac+dg環境刪除歸檔日誌
- 利用sqlplus指令碼刪除備庫歸檔SQL指令碼
- DataGuard已應用歸檔日誌刪除指令碼指令碼
- 【ARCH】留存,Oracle11g之前Dataguard環境刪除歸檔指令碼Oracle指令碼
- oracle刪除歸檔日誌Oracle
- Oracle歸檔日誌刪除Oracle
- oracle rman 刪除過期的歸檔Oracle
- golang map的判斷,刪除Golang
- 刪除歸檔
- 邏輯dg刪除主庫過期歸檔日誌
- oracle 刪除過期的歸檔日誌Oracle
- 【Oracle】 rman 刪除歸檔日誌的命令Oracle
- SHELL指令碼檢查Oracle DG備庫是否已經應用歸檔指令碼Oracle
- 定時刪除檔案指令碼指令碼
- 自動刪除歸檔日誌的指令碼(尤其是dataguard環境)指令碼
- Standby Redo Log 的設定原則、建立、刪除、檢視、歸檔位置
- 歸檔日誌的刪除
- oracle dataguard 自動刪除歸檔日誌Oracle
- Oracle dg歸檔同步失敗Oracle
- 如何正確刪除ORACLE歸檔日誌檔案Oracle
- Oracle Data Guard 主庫歸檔檔案刪除策略Oracle
- Oracle Data Guard 主庫 歸檔檔案 刪除策略Oracle
- 刪除七天以前檔案的指令碼指令碼
- DG_保證歸檔日誌不能隨意被刪除的四種方法
- 強制刪除歸檔檔案
- 刪除歸檔日誌檔案