RMAN ---delete obsolete 不能刪除 控制文件copy
說明 /tmp/contrlfile /tmp/controlfile.bkp /home/oracle/control01.ctl 已經通過os命令刪除了
現在的疑問是如何刪除這些 obsolete的記錄:
以下是測試結果:
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy 2 22-APR-13 /tmp/contrlfile.
Control File Copy 3 22-APR-13 /tmp/controlfile.bkp
Control File Copy 4 23-JUL-13 /home/oracle/control01.ctl
RMAN> delete obsolete;
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
-------------------- ------ ------------------ --------------------
Control File Copy 2 22-APR-13 /tmp/contrlfile.
Control File Copy 3 22-APR-13 /tmp/controlfile.bkp
Control File Copy 4 23-JUL-13 /home/oracle/control01.ctl
Do you really want to delete the above objects (enter YES or NO)? yes
RMAN-06207: WARNING: 3 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: Datafile Copy /tmp/contrlfile.
RMAN-06214: Datafile Copy /tmp/controlfile.bkp
RMAN-06214: Datafile Copy /home/oracle/control01.ctl
----根據上面的提示,使用crosscheck 檢測
RMAN> crosscheck backup of database;
specification does not match any backup in the repository
RMAN> crosscheck backup of controlfile;
specification does not match any backup in the repository
RMAN> delete expired backup;
specification does not match any backup in the repository
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
40 B F A DISK 19-NOV-13 1 1 NO TAG20131119T072057
RMAN>
請教下大家如何刪除以上的 obsolete 記錄!
解決方法:
RMAN> CROSSCHECK COPY;
specification does not match any datafile copy in the repository
specification does not match any archived log in the repository
validation failed for control file copy
control file copy file name=/home/oracle/control01.ctl RECID=4 STAMP=821523959
validation failed for control file copy
control file copy file name=/tmp/controlfile.bkp RECID=3 STAMP=813384451
validation failed for control file copy
control file copy file name=/tmp/contrlfile. RECID=2 STAMP=813384351
Crosschecked 3 objects
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy 2 22-APR-13 /tmp/contrlfile.
Control File Copy 3 22-APR-13 /tmp/controlfile.bkp
Control File Copy 4 23-JUL-13 /home/oracle/control01.ctl
RMAN> delete expired copy;
specification does not match any datafile copy in the repository
specification does not match any archived log in the repository
List of Control File Copies
===========================
Key S Completion Time Ckp SCN Ckp Time
------- - --------------- ---------- ---------------
4 X 23-JUL-13 2243850 23-JUL-13
Name: /home/oracle/control01.ctl
Tag: TAG20130723T090559
3 X 22-APR-13 1495438 22-APR-13
Name: /tmp/controlfile.bkp
Tag: TAG20130422T040730
2 X 22-APR-13 1490032 22-APR-13
Name: /tmp/contrlfile.
Tag: TAG20130422T040550
Do you really want to delete the above objects (enter YES or NO)? yes
deleted control file copy
control file copy file name=/home/oracle/control01.ctl RECID=4 STAMP=821523959
deleted control file copy
control file copy file name=/tmp/controlfile.bkp RECID=3 STAMP=813384451
deleted control file copy
control file copy file name=/tmp/contrlfile. RECID=2 STAMP=813384351
Deleted 3 EXPIRED objects
RMAN> report expired;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "expired": expecting one of: "device, need, obsolete, schema, unrecoverable"
RMAN-01007: at line 1 column 8 file: standard input
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found
RMAN>
總結:
Crosschecking Backups
The CROSSCHECK command checks whether RMAN backups and copies in the repository are still readable by RMAN. Assuming that you have configured automatic channels, you can run these commands:
RMAN> CROSSCHECK BACKUP; # checks RMAN backups on configured devices
RMAN> CROSSCHECK COPY; # checks RMAN image copies on configured devices
這兩個命令還是有點區別的,主要還是要認清楚備份的類型。
If backups are stored with a media manager and sbt channels are not configured, then you must allocate a maintenance channel before CROSSCHECK and DELETE commands on sbt devices:
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;---如果使用磁帶庫來備份,需要開一個專用的維護通道。
RMAN> CROSSCHECK BACKUP;