備庫自動刪除已應用的歸檔日誌
經常碰到資料庫因為歸檔日誌堆積而造成磁碟空間滿的情況,這裡如果備庫歸檔不備份的話,則需要定期刪除。
下面的指令碼在AIX6.1上執行透過:
REPORT="/tmp/delArch.log"
logtokeep=40----想保留的歸檔Seq個數
#source related profile
. /home/oracle/.profile_11g
echo "*******delete applied archivelog*********\n" > $REPORT
### Get Max sequence# applied from Primary database ###
applied_seq1=`sqlplus -silent /nolog <
connect / as sysdba
whenever sqlerror exit sql.sqlcode
set pagesize 0 feedback off verify off heading off echo off
select max(sequence#) from v\\$archived_log where applied = 'YES' and REGISTRAR='RFS';
exit;
EOSQL`
### Calculate the archive log to delete ###
arch_to_del1=$(($applied_seq1-$logtokeep))
if [ -z "$arch_to_del1" ]; then
echo "No rows returned from database" >> $REPORT
exit 0
fi
#begin deleting, 如果是RAC,需要加上thread
echo "delete noprompt archivelog until sequence $arch_to_del1;"|rman target / >> $REPORT
Notes,V$ARCHIVED_LOG檢視幾個column解釋:
columns V$ARCHIVED_LOG.REGISTRAR and APPLIED
If REGISTRAR=’RFS’ and APPLIEDis NO, then the log has arrived at the standby but has not yet been applied.
If REGISTRAR=’RFS’ and APPLIED is YES, the log has arrived and been applied at the standby database.
column V$ARCHIVED_LOG.DELETED
Indicates whether an RMAN DELETE command has physically deleted the archived log file from disk (YES) or not (NO)
RMAN EXPIRED
Removes only files whose status in the repository is EXPIRED.
RMAN marks backups and copies as expired when you run a CROSSCHECK command and the files are absent or inaccessible.
To determine which files are expired, run a LIST EXPIRED command.
RMAN NOPROMPT
Beginning in Oracle9i, RMAN’s default behavior is to prompt for confirmation when you run DELETE EXPIRED.
In prior releases, RMAN did not prompt.
下面的指令碼在AIX6.1上執行透過:
REPORT="/tmp/delArch.log"
logtokeep=40----想保留的歸檔Seq個數
#source related profile
. /home/oracle/.profile_11g
echo "*******delete applied archivelog*********\n" > $REPORT
### Get Max sequence# applied from Primary database ###
applied_seq1=`sqlplus -silent /nolog <
whenever sqlerror exit sql.sqlcode
set pagesize 0 feedback off verify off heading off echo off
select max(sequence#) from v\\$archived_log where applied = 'YES' and REGISTRAR='RFS';
exit;
EOSQL`
### Calculate the archive log to delete ###
arch_to_del1=$(($applied_seq1-$logtokeep))
if [ -z "$arch_to_del1" ]; then
echo "No rows returned from database" >> $REPORT
exit 0
fi
#begin deleting, 如果是RAC,需要加上thread
echo "delete noprompt archivelog until sequence $arch_to_del1;"|rman target / >> $REPORT
Notes,V$ARCHIVED_LOG檢視幾個column解釋:
columns V$ARCHIVED_LOG.REGISTRAR and APPLIED
If REGISTRAR=’RFS’ and APPLIEDis NO, then the log has arrived at the standby but has not yet been applied.
If REGISTRAR=’RFS’ and APPLIED is YES, the log has arrived and been applied at the standby database.
column V$ARCHIVED_LOG.DELETED
Indicates whether an RMAN DELETE command has physically deleted the archived log file from disk (YES) or not (NO)
RMAN EXPIRED
Removes only files whose status in the repository is EXPIRED.
RMAN marks backups and copies as expired when you run a CROSSCHECK command and the files are absent or inaccessible.
To determine which files are expired, run a LIST EXPIRED command.
RMAN NOPROMPT
Beginning in Oracle9i, RMAN’s default behavior is to prompt for confirmation when you run DELETE EXPIRED.
In prior releases, RMAN did not prompt.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/628922/viewspace-1181660/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dg刪除備庫已經應用的歸檔日誌指令碼指令碼
- DataGuard已應用歸檔日誌刪除指令碼指令碼
- DataGuard備庫刪除已經應用的日誌
- 配置rman來自動刪除應用過的歸檔日誌
- crontab不能自動刪除歸檔日誌
- oracle dataguard 自動刪除歸檔日誌Oracle
- 如何定期自動刪除歸檔日誌
- oracle rman不能自動刪除歸檔日誌備份解決Oracle
- 手動刪除歸檔日誌
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- 配置RMAN清除已應用到備庫的歸檔日誌
- 歸檔日誌的刪除
- 誤刪歸檔日誌除導致備份歸檔日誌失敗
- DG-在主庫/備庫刪除已經應用過的日誌.txt
- asm下如何自動刪除standby上已經applied過的歸檔日誌ASMAPP
- oracle刪除歸檔日誌Oracle
- Oracle歸檔日誌刪除Oracle
- 刪除歸檔日誌檔案
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- DELETE OBSOLETE不刪除歸檔日誌以及歸檔的備份集delete
- 刪除data guard歸檔日誌
- 作用RMAN 刪除歸檔日誌
- 用rman 正確地刪除歸檔日誌
- 刪除歸檔,保留最近的5個歸檔日誌
- 自動刪除歸檔日誌的指令碼(尤其是dataguard環境)指令碼
- oracle 刪除過期的歸檔日誌Oracle
- 歸檔日誌刪除的五種方法
- 【Oracle】 rman 刪除歸檔日誌的命令Oracle
- 當ORACLE歸檔日誌滿後如何正確刪除歸檔日誌Oracle
- 邏輯dg刪除主庫過期歸檔日誌
- 配置RMAN清除已應用到備庫的歸檔日誌 (文件 ID 1577382.1)
- rman刪除舊的歸檔日誌問題
- RMAN delete archivelog命令刪除歸檔日誌及歸檔日誌拷貝deleteHive
- rman刪除歸檔日誌命令集
- 【警鐘】謹慎刪除歸檔日誌
- 聯機重做日誌、歸檔日誌、備用重做日誌
- 如何正確刪除ORACLE歸檔日誌檔案Oracle
- DATAGUARD_standby刪除歸檔日誌的指令碼指令碼