当前位置: 首页 > 工具软件 > Crosscheck > 使用案例 >

oracle rman crosscheck 命令

龙智
2023-12-01

CROSSCHECK命令:
     用于核对磁盘和磁带上的备份文件,以确保RMAN资料库与备份文件保持同步。注意:该命令只会检查RMAN资料库所记载的备份文件。当执行crosscheck命令时,如果资料库记录不匹配于备份文件的物理状态,那么该命令会更新资料库记录的状态信息。备份文件的状态包括:AVALIABLE、UNAVALIABLE、EXPIRED。   

1、核对所有备份集       RMAN> crosscheck backup;   

2、核对所有数据文件的备份集       RMAN> crosscheck backup of database;   

3、核对特定表空间的备份集       RMAN> crosscheck backup of tablespace users;   

4、核对特定数据文件的备份集       RMAN> crosscheck backup of datafile 4;   

5、核对控制文件的备份集       RMAN> crosscheck backup of controlfile;   

6、核对SPFILE的备份集       RMAN> crosscheck backup of spfile;   

7、核对归档日志的备份集       RMAN> crosscheck backup of archivelog sequence 3;   

8、核对所有映像副本       RMAN> crosscheck copy;   

9、核对所有数据文件的映像副本       RMAN> crosscheck copy of database;   

10、核对特定表空间的映像副本       RMAN> crosscheck copy of tablespace users;   

11、核对特定数据文件的映像副本       RMAN> crosscheck copy of datafile 6;   

12、核对归档日志的映像副本       RMAN> crosscheck copy of archivelog sequence 4;   

13、核对控制文件的映像副本       RMAN> crosscheck copy of controlfile;  


前段时间看到有无效备份,怎么也删除不掉。

后来使用:

以下方法搞定:


crosscheck copy;
或者
crosscheck backup;
然后
delete expired copy;


前面测试使用的命令如下:

delete expired backup;
delete expired archivelog all;


RMAN> delete expired archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=8055 instance=racdb2 device type=DISK
specification does not match any archived log in the repository

RMAN>

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     1      2013-05-10 14:28:30 /opt/backup/control01.ctl
Control File Copy     2      2013-10-15 10:41:06 /tmp/control01.ctl
Control File Copy     4      2013-10-21 16:25:03 +RECOVERY/racdb/snapshot/snapcf_racdb2.f

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
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy     1      2013-05-10 14:28:30 /opt/backup/control01.ctl
Control File Copy     2      2013-10-15 10:41:06 /tmp/control01.ctl
Control File Copy     4      2013-10-21 16:25:03 +RECOVERY/racdb/snapshot/snapcf_racdb2.f

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   /opt/backup/control01.ctl
RMAN-06214: Datafile Copy   /tmp/control01.ctl
RMAN-06214: Datafile Copy   +RECOVERY/racdb/snapshot/snapcf_racdb2.f


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     1      2013-05-10 14:28:30 /opt/backup/control01.ctl
Control File Copy     2      2013-10-15 10:41:06 /tmp/control01.ctl
Control File Copy     4      2013-10-21 16:25:03 +RECOVERY/racdb/snapshot/snapcf_racdb2.f

RMAN> crosscheck backupset ;

RMAN>

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     1      2013-05-10 14:28:30 /opt/backup/control01.ctl
Control File Copy     2      2013-10-15 10:41:06 /tmp/control01.ctl
Control File Copy     4      2013-10-21 16:25:03 +RECOVERY/racdb/snapshot/snapcf_racdb2.f

RMAN> delete expired backup;

using channel ORA_DISK_1
specification does not match any backup in the repository

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     1      2013-05-10 14:28:30 /opt/backup/control01.ctl
Control File Copy     2      2013-10-15 10:41:06 /tmp/control01.ctl
Control File Copy     4      2013-10-21 16:25:03 +RECOVERY/racdb/snapshot/snapcf_racdb2.f
————————————————
版权声明:本文为CSDN博主「边城cn」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/miyatang/article/details/17410831

 类似资料: