關於RMAN-06207和RMAN-06208錯誤的分析以及解決辦法

dcswinner發表於2011-10-31

近段時間以來對手上兩個維護的資料庫做備份監控,分別發現兩個告警,現在分別作個說明。

通過查詢:SELECT STATUS,OPERATION,TO_CHAR(END_TIME,'YYYY-MM-DD HH24:MI:SS'),COMMAND_ID  FROM V$RMAN_STATUS ORDER BY 4 DESC;

STATUS OPERATION TO_CHAR(END_TIME,'YYYY-MM-DDHH COMMAND_ID
COMPLETED DELETE 2011-10-31 11:46:25 2011-10-31T11:45:07
COMPLETED RMAN 2011-10-31 16:24:10 2011-10-31T11:45:07
COMPLETED WITH WARNINGS DELETE 2011-10-31 12:10:56 2011-10-31T11:45:07
COMPLETED DELETE 2011-10-31 12:12:18 2011-10-31T11:45:07
FAILED DELETE 2011-10-31 12:33:00 2011-10-31T11:45:07
COMPLETED DELETE 2011-10-31 12:13:03 2011-10-31T11:45:07

發現有一個狀態是有告警的,進一步分析備份日誌發現:
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           6446   26-AUG-11
  Backup Piece       6446   26-AUG-11          /dbbak/b1mktu8g_1_1
Backup Set           6824   29-SEP-11
  Backup Piece       6824   29-SEP-11          /dbbak/databak/c-730968613-20110929-00
deleted backup piece
backup piece handle=/dbbak/databak/c-730968613-20110929-00 recid=6824 stamp=763088853
Deleted 1 objects

RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Backup Piece    /dbbak/b1mktu8g_1_1
/dbbak/b1mktu8g_1_1 檔案是先前備份目錄下的備份檔案,上次換目錄時,手工刪除了,因此報這個錯誤,但是隻抱這個錯誤不足為怪,問題時我 crosscheck backupset;時根本就不對這個檔案校驗,

RMAN> crosscheck backupset;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=382 instance=tjdb1 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=1648 instance=tjdb1 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=377 instance=tjdb1 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=392 instance=tjdb1 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1rmqe9j0_1_1 recid=7176 stamp=765929062
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1qmqe9iv_1_1 recid=7177 stamp=765929059
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1pmqe9iu_1_1 recid=7178 stamp=765929062
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1omqe9iu_1_1 recid=7179 stamp=765929058
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/20mqeklv_1_1 recid=7181 stamp=765940421
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1vmqeklv_1_1 recid=7182 stamp=765940420
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/21mqelmp_1_1 recid=7183 stamp=765941467
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1tmqeklv_1_1 recid=7184 stamp=765940416
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/1umqeklv_1_1 recid=7185 stamp=765940419
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/dbbak/databak/c-730968613-20111031-01 recid=7186 stamp=765941821
Crosschecked 10 objects

delete expired backupset;時自然也就不去在控制檔案裡刪除這個檔案了,

RMAN> delete expired backupset;

using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4

執行 delete obsolete;時還是報RMAN-06207的錯誤。

RMAN> delete obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           6446   26-AUG-11        
  Backup Piece       6446   26-AUG-11          /dbbak/b1mktu8g_1_1

Do you really want to delete the above objects (enter YES or NO)? yes

RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Backup Piece    /dbbak/b1mktu8g_1_1

莫非需要指定備份集進行校驗嗎?試試看:

RMAN> crosscheck backupset 6446;

using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/dbbak/b1mktu8g_1_1 recid=6446 stamp=760150291
Crosschecked 1 objects
這次校驗能校驗上了,看來還需要指定備份集進行校驗啊,再來刪除:

RMAN> delete obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           6446   26-AUG-11        
  Backup Piece       6446   26-AUG-11          /dbbak/b1mktu8g_1_1

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/dbbak/b1mktu8g_1_1 recid=6446 stamp=760150291
Deleted 1 objects
刪除成功,問題解決!

或者通過下面的方式校驗也能刪除:

RMAN> change backupset 6446 crosscheck ;

後來官方文件發現,其實還有一種解決辦法:

RMAN> delete force backupset 6446;  ------強制刪除。

因為檔案已經刪掉了,沒法驗證,下次如在其他地方碰到再驗證一下:)

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12129601/viewspace-709994/,如需轉載,請註明出處,否則將追究法律責任。

相關文章