rman归档删除
rman: delete [all] input
數(shù)據(jù)庫oracle 11g 全備腳本如下:
rman target /? <<EOF
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
set limit channel t1 kbytes 4194304;
set limit channel t2 kbytes 4194304;
set limit channel t3 kbytes 4194304;
backup
format '/u01/rman/full_MPdb_%U'
(database include current controlfile);
backup
format '/u01/rman/redolog_MPdb_%U'? archivelog all delete? input;
sql ' alter system archive log current';
release channel t1;
release channel t2;
release channel t3;
}
exit
EOF
以下是11g下的全備
rman target /? <<EOF
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
set limit channel t1 kbytes 4194304;
set limit channel t2 kbytes 4194304;
backup full tag 'order' as compressed backupset database
include current controlfile
format '/u01/rman/full_MP_%d_%T_%s'
plus archivelog
format '/u01/rman/redolog_MP_%d_%T_%s' delete all input;
delete noprompt obsolete;
release channel t1;
release channel t2;
}
exit
EOF
RMAN> show retention policy;
使用目標(biāo)數(shù)據(jù)庫控制文件替代恢復(fù)目錄
db_unique_name 為 ORAMP 的數(shù)據(jù)庫的 RMAN 配置參數(shù)為:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
-----------------------------------------------------------------------------
問題是每次備份完后只刪除/u01/app/oracle/flash_recovery_area/ORACLE11/archivelog下的舊的歸檔日志文件
但是/u01/app/oracle/product/11.1.0/db_1/dbs下的歸檔日志并沒有刪除
原因如下:
backup archivelog all delete input 和 backup archivelog all delete all input的區(qū)別是什么?
有資料上說的是:
delete input 表示備份結(jié)束后刪除歸檔日志
delete all input 表示備份結(jié)束后刪除所有歸檔日志目錄文件
做了試驗(yàn),沒有刪除目錄啊........
結(jié)論:
當(dāng)有多個(gè)歸檔目錄時(shí) 例如:log_archive_dest_2 、log_archive_dest_1
--delete input后 log_archive_dest_2??中的archivelog并沒有被刪除(只刪除log_archive_dest_1中的)
如果delete all input,所有l(wèi)og_archive_dest_n中的備份的archivelog都會被刪除~
-----------------------------------------------------------------------------
還有注意的就是如果flash_recovery_area設(shè)置太小會出問題
ORA-00257: 歸檔程序錯(cuò)誤。在釋放之前僅限于內(nèi)部連接
檢查alert_log日志原來是歸檔日志占滿了FLASH_RECOVERY_AREA 的2G空間。
解決方法1:先手工刪除D:\oracle\product\10.2.0\flash_recovery_area里面的
日志,
然后用戶用rman進(jìn)入把歸檔日志刪除
1)命令>rman target/
2)命令>crosscheck archivelog all;
3)命令>delete expired archivelog all;
4)命令>exit
上面第3個(gè)命令
delete noprompt? expired archivelog all; 其中noprompt 是不用手工確認(rèn).
解決方法2:改變了FLASH_RECOVERY_AREA的大小
修改命令>alter system set db_recovery_file_dest_size=8G scope=both;
查看命令>show parameter db_recovery_file_dest_size
?
另外一個(gè)rman要注意地方,比如手工刪除rman的備份文件,但rman認(rèn)為沒有刪除,解決方法:
crosscheck backup ;
delete noprompt expired backup ;
這種方法可以解決 刪除無效的或手工通過rm刪除的問題。
轉(zhuǎn)載于:https://www.cnblogs.com/hsuchan/p/3544429.html
總結(jié)
- 上一篇: 文本字符集转换
- 下一篇: 89C51单片机定时器控制的流水灯