1. 程式人生 > >在OS手工刪除歸檔後用RMAN備份歸檔報錯

在OS手工刪除歸檔後用RMAN備份歸檔報錯

RMAN> backup archivelog all format '/data/backup/%d_ARC_%T_%s_%p.bak' delete all input   ;

Starting backup at 22-DEC-11
current log archived
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 12/22/2011 14:41:53
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /data/oracle/flash_recovery_area/LXC/archivelog/1_138_764162411.dbf
ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

RMAN> CROSSCHECK ARCHIVELOG ALL;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
validation succeeded for archived log
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_136_764162411.dbf recid=126 stamp=770559336
validation succeeded for archived log
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_137_764162411.dbf recid=127 stamp=770559338
validation failed for archived log
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_138_764162411.dbf recid=128 stamp=770559345
validation succeeded for archived log
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_139_764162411.dbf recid=129 stamp=770560433
validation succeeded for archived log
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_1_770566677.dbf recid=130 stamp=770568113
Crosschecked 5 objects


RMAN> backup archivelog all format '/data/backup/%d_ARC_%T_%s_%p.bak' delete all input   ;


Starting backup at 22-DEC-11
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=136 recid=126 stamp=770559336
input archive log thread=1 sequence=137 recid=127 stamp=770559338
input archive log thread=1 sequence=139 recid=129 stamp=770560433
channel ORA_DISK_1: starting piece 1 at 22-DEC-11
channel ORA_DISK_1: finished piece 1 at 22-DEC-11
piece handle=/data/backup/LXC_ARC_20111222_16_1.bak tag=TAG20111222T144214 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_136_764162411.dbf recid=126 stamp=770559336
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_137_764162411.dbf recid=127 stamp=770559338
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_139_764162411.dbf recid=129 stamp=770560433
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=130 stamp=770568113
input archive log thread=1 sequence=2 recid=131 stamp=770568133
channel ORA_DISK_1: starting piece 1 at 22-DEC-11
channel ORA_DISK_1: finished piece 1 at 22-DEC-11
piece handle=/data/backup/LXC_ARC_20111222_17_1.bak tag=TAG20111222T144214 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_1_770566677.dbf recid=130 stamp=770568113
archive log filename=/data/oracle/flash_recovery_area/LXC/archivelog/1_2_770566677.dbf recid=131 stamp=770568133
Finished backup at 22-DEC-11

---其實只要做完crosscheck archivelog all; 就可以備份了,並不需要 delete expired archivelog all

當刪除了某個歸檔(1_3_770566677)後 用RMAN>list archivelog all ; 檢視的時候會有:

RMAN>  list archivelog all;

using target database control file instead of recovery catalog

List of Archived Log Copies
Key     Thrd Seq     S      Low Time    Name
-------     ---- -------  -           ---------        ----
132     1    3         A          22-DEC-11 /data/oracle/flash_recovery_area/LXC/archivelog/1_3_770566677.dbf
133     1    4         A          22-DEC-11 /data/oracle/flash_recovery_area/LXC/archivelog/1_4_770566677.dbf
可以看到1_138_764162411.dbf 狀態是A

但是這個檔案已經不在硬碟上了,

做完crosscheck archivelog all;

再 list archivelog all;看:

Key     Thrd Seq     S      Low Time    Name
-------     ---- -------  -           ---------        ----
132     1    3         X          22-DEC-11 /data/oracle/flash_recovery_area/LXC/archivelog/1_3_770566677.dbf
133     1    4         A          22-DEC-11 /data/oracle/flash_recovery_area/LXC/archivelog/1_4_770566677.dbf

狀態變成X了。這個時候在用 backup archivelog all 就不會報錯了。但是在 list archivelog all;裡面還有這個記錄

用delete expired archivelog all; 可以刪掉無效的記錄。