刪除DG歸檔保留5個
[oracle@shanxi admin]$ crontab -l
0 20 * * * /home/oracle/admin/del_arch.sh >> /home/oracle/admin/del_arch.log 2>&1
[oracle@shanxi admin]$ cat /home/oracle/admin/del_arch.sh
#!/bin/bash
. /home/oracle/.bash_profile
reserve=5
max_seq=`sqlplus -s '/ as sysdba '<set linesize 200 pagesize 0 feedback off trimspool on echo off termout off time off timing off
select max(sequence#) from v\\$archived_log where name is not null;
exit;
EOF`
#echo ${max_seq}
echo "------------------------PROD-------------------------"
echo "----------------------Begin:`date`-----------------------"
hig_seq=`expr ${max_seq} - ${reserve} `
#echo $hig_seq
rman target sys/XXX@221.204.2XX.XXPROD <crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog high sequence ${hig_seq};
exit;
EOF
echo -e "----------------------End:`date`-------------------------------\n"
echo -e "\n-----------------------ST---------------------------"
echo "----------------------Begin:`date`-----------------------"
rman target sys/XXX@221.204.XXX.XXX/ST <crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog high sequence ${hig_seq};
exit;
EOF
echo -e "----------------------End:`date`-------------------------------\n"
0 20 * * * /home/oracle/admin/del_arch.sh >> /home/oracle/admin/del_arch.log 2>&1
[oracle@shanxi admin]$ cat /home/oracle/admin/del_arch.sh
#!/bin/bash
. /home/oracle/.bash_profile
reserve=5
max_seq=`sqlplus -s '/ as sysdba '<
select max(sequence#) from v\\$archived_log where name is not null;
exit;
EOF`
#echo ${max_seq}
echo "------------------------PROD-------------------------"
echo "----------------------Begin:`date`-----------------------"
hig_seq=`expr ${max_seq} - ${reserve} `
#echo $hig_seq
rman target sys/XXX@221.204.2XX.XXPROD <
delete noprompt expired archivelog all;
delete noprompt archivelog high sequence ${hig_seq};
exit;
EOF
echo -e "----------------------End:`date`-------------------------------\n"
echo -e "\n-----------------------ST---------------------------"
echo "----------------------Begin:`date`-----------------------"
rman target sys/XXX@221.204.XXX.XXX/ST <
delete noprompt expired archivelog all;
delete noprompt archivelog high sequence ${hig_seq};
exit;
EOF
echo -e "----------------------End:`date`-------------------------------\n"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-759104/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 刪除歸檔,保留最近的5個歸檔日誌
- 物理DG刪除歸檔測試
- DG歸檔自動刪除 & _log_deletion_policy
- rac+dg環境刪除歸檔日誌
- 定時刪除歸檔(僅保留最近兩天的)
- Oracle DG standby刪除歸檔的判斷指令碼Oracle指令碼
- 刪除歸檔
- 邏輯dg刪除主庫過期歸檔日誌
- Linux保留幾個檔案其餘刪除Linux
- ORACLE刪除歸檔Oracle
- 保留最近的2個歸檔
- dg刪除備庫已經應用的歸檔日誌指令碼指令碼
- 強制刪除歸檔檔案
- 刪除歸檔日誌檔案
- oracle刪除歸檔日誌Oracle
- 歸檔日誌的刪除
- Rman Crosscheck刪除失效歸檔ROS
- Oracle歸檔日誌刪除Oracle
- 使用RMAN安全刪除歸檔檔案
- DG_保證歸檔日誌不能隨意被刪除的四種方法
- 刪除data guard歸檔日誌
- 手動刪除歸檔日誌
- rman 刪除所有過期歸檔
- 作用RMAN 刪除歸檔日誌
- 定期刪除歸檔檔案的指令碼指令碼
- oracle rman 刪除過期的歸檔Oracle
- 生產上刪除歸檔的命令
- rman刪除指定時間的歸檔
- oracle 刪除過期的歸檔日誌Oracle
- rman刪除歸檔日誌命令集
- crontab不能自動刪除歸檔日誌
- oracle dataguard 自動刪除歸檔日誌Oracle
- 歸檔日誌刪除的五種方法
- 如何定期自動刪除歸檔日誌
- 【Oracle】 rman 刪除歸檔日誌的命令Oracle
- 【警鐘】謹慎刪除歸檔日誌
- 如何正確刪除ORACLE歸檔日誌檔案Oracle
- Oracle Data Guard 主庫歸檔檔案刪除策略Oracle