• 手动删除RMAN备份的方法


    查询

    RMAN> list backup;
    
    using target database control file instead of recovery catalog
    
    List of Backup Sets
    ===================
    
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    37      Full    9.33M      DISK        00:00:00     29-MAY-15      
            BP Key: 37   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135312
            Piece Name: /home/oracle/backup/20150529135121/ZGW_cntrl_42_1_42
      Control File Included: Ckp SCN: 1088993      Ckp time: 29-MAY-15
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    38      Full    592.95M    DISK        00:00:00     29-MAY-15      
            BP Key: 38   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135134
            Piece Name: /home/oracle/backup/20150529135121/ZGW_20150529_18q85g77_1_1
      List of Datafiles in backup set 38
      File LV Type Ckp SCN    Ckp Time  Name
      ---- -- ---- ---------- --------- ----
      1       Full 1088865    29-MAY-15 /opt/oracle/oradata/zgw/system01.dbf
      4       Full 1088865    29-MAY-15 /opt/oracle/oradata/zgw/users01.dbf
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    39      Full    80.00K     DISK        00:00:00     29-MAY-15      
            BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135318
            Piece Name: /home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak
      SPFILE Included: Modification time: 29-MAY-15
      SPFILE db_unique_name: ZGW
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    40      Full    398.51M    DISK        00:00:00     29-MAY-15      
            BP Key: 40   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135134
            Piece Name: /home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1
      List of Datafiles in backup set 40
      File LV Type Ckp SCN    Ckp Time  Name
      ---- -- ---- ---------- --------- ----
      2       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/sysaux01.dbf
      3       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/undotbs01.dbf
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    41      1.50M      DISK        00:00:00     29-MAY-15      
            BP Key: 41   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984400_44
    
      List of Archived Logs in backup set 41
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    18      1087129    29-MAY-15 1088858    29-MAY-15
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    42      723.50K    DISK        00:00:00     29-MAY-15      
            BP Key: 42   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984401_45
    
      List of Archived Logs in backup set 42
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    19      1088858    29-MAY-15 1089038    29-MAY-15

    指定备份片序号删除

    RMAN> delete backupset 37,38;
    
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=36 device type=DISK
    
    List of Backup Pieces
    BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    37      37      1   1   AVAILABLE   DISK        /home/oracle/backup/20150529135121/ZGW_cntrl_42_1_42
    38      38      1   1   AVAILABLE   DISK        /home/oracle/backup/20150529135121/ZGW_20150529_18q85g77_1_1
    
    Do you really want to delete the above objects (enter YES or NO)? y
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_cntrl_42_1_42 RECID=37 STAMP=880985777
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_20150529_18q85g77_1_1 RECID=38 STAMP=880985777
    Deleted 2 objects

    操作系统命令删除后

    [oracle@Oracle11_2 20150529135121]$ ls
    backupall_20150529135121.log  %_spfile_1bq85gae_1_1.bak  ZGW_20150529_19q85g78_1_1  ZGW_arc_880984400_44  ZGW_arc_880984401_45
    [oracle@Oracle11_2 20150529135121]$ rm  ZGW_*
    [oracle@Oracle11_2 20150529135121]$ ls
    backupall_20150529135121.log  %_spfile_1bq85gae_1_1.bak
    [oracle@Oracle11_2 20150529135121]$ 

    查询

    RMAN> list backup;
    
    
    List of Backup Sets
    ===================
    
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    39      Full    80.00K     DISK        00:00:00     29-MAY-15      
            BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135318
            Piece Name: /home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak
      SPFILE Included: Modification time: 29-MAY-15
      SPFILE db_unique_name: ZGW
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    40      Full    398.51M    DISK        00:00:00     29-MAY-15      
            BP Key: 40   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135134
            Piece Name: /home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1
      List of Datafiles in backup set 40
      File LV Type Ckp SCN    Ckp Time  Name
      ---- -- ---- ---------- --------- ----
      2       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/sysaux01.dbf
      3       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/undotbs01.dbf
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    41      1.50M      DISK        00:00:00     29-MAY-15      
            BP Key: 41   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984400_44
    
      List of Archived Logs in backup set 41
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    18      1087129    29-MAY-15 1088858    29-MAY-15
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    42      723.50K    DISK        00:00:00     29-MAY-15      
            BP Key: 42   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984401_45
    
      List of Archived Logs in backup set 42
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    19      1088858    29-MAY-15 1089038    29-MAY-15

    检查并删除

    RMAN> crosscheck backup; --检查备份物理文件状态
    
    using channel ORA_DISK_1
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak RECID=39 STAMP=880985777
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1 RECID=40 STAMP=880985777
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_arc_880984400_44 RECID=41 STAMP=880985777
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_arc_880984401_45 RECID=42 STAMP=880985777
    Crosschecked 4 objects
    
    
    RMAN> list expired backup;  --查看检查结果
    
    
    List of Backup Sets
    ===================
    
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    40      Full    398.51M    DISK        00:00:00     29-MAY-15      
            BP Key: 40   Status: EXPIRED  Compressed: NO  Tag: TAG20150529T135134
            Piece Name: /home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1
      List of Datafiles in backup set 40
      File LV Type Ckp SCN    Ckp Time  Name
      ---- -- ---- ---------- --------- ----
      2       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/sysaux01.dbf
      3       Full 1088866    29-MAY-15 /opt/oracle/oradata/zgw/undotbs01.dbf
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    41      1.50M      DISK        00:00:00     29-MAY-15      
            BP Key: 41   Status: EXPIRED  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984400_44
    
      List of Archived Logs in backup set 41
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    18      1087129    29-MAY-15 1088858    29-MAY-15
    
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    42      723.50K    DISK        00:00:00     29-MAY-15      
            BP Key: 42   Status: EXPIRED  Compressed: NO  Tag: TAG20150529T135320
            Piece Name: /home/oracle/backup/20150529135121/ZGW_arc_880984401_45
    
      List of Archived Logs in backup set 42
      Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
      ---- ------- ---------- --------- ---------- ---------
      1    19      1088858    29-MAY-15 1089038    29-MAY-15
    
    RMAN> delete expired backup;  --删除状态为expired的备份,expired是指物理文件不存在的备份集,obsolete指过期的备份集
    
    using channel ORA_DISK_1
    
    List of Backup Pieces
    BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    40      40      1   1   EXPIRED     DISK        /home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1
    41      41      1   1   EXPIRED     DISK        /home/oracle/backup/20150529135121/ZGW_arc_880984400_44
    42      42      1   1   EXPIRED     DISK        /home/oracle/backup/20150529135121/ZGW_arc_880984401_45
    
    Do you really want to delete the above objects (enter YES or NO)? y
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_20150529_19q85g78_1_1 RECID=40 STAMP=880985777
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_arc_880984400_44 RECID=41 STAMP=880985777
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/ZGW_arc_880984401_45 RECID=42 STAMP=880985777
    Deleted 3 EXPIRED objects
    delete expired backup 与 delete obsolete 比较。
    RMAN> list backup;
    
    
    List of Backup Sets
    ===================
    
    
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    39      Full    80.00K     DISK        00:00:00     29-MAY-15      
            BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20150529T135318
            Piece Name: /home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak
      SPFILE Included: Modification time: 29-MAY-15
      SPFILE db_unique_name: ZGW
    
    RMAN> crosscheck backup;
    
    using channel ORA_DISK_1
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak RECID=39 STAMP=880985777
    Crosschecked 1 objects
    
    
    RMAN> delete obsolete;  --只能删除过期备份
    
    RMAN retention policy will be applied to the command
    RMAN retention policy is set to recovery window of 7 days
    using channel ORA_DISK_1
    no obsolete backups found
    
    RMAN> delete expired backup; --只能删除物理不存在的备份记录
    
    using channel ORA_DISK_1
    
    List of Backup Pieces
    BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    39      39      1   1   EXPIRED     DISK        /home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak
    
    Do you really want to delete the above objects (enter YES or NO)? y
    deleted backup piece
    backup piece handle=/home/oracle/backup/20150529135121/%_spfile_1bq85gae_1_1.bak RECID=39 STAMP=880985777
    Deleted 1 EXPIRED objects
  • 相关阅读:
    底部导航栏
    判断手机是否连接网络
    瀑布流(圆角,卡片效果)
    列表卡片效果
    使用Glide改变图片的圆角
    条形码EAN-13码和EAN-8码的原理
    自定义底部弹窗
    【代码笔记】Java常识性基础补充(一)——赋值运算符、逻辑运算符、三元运算符、Scanner类、键盘输入、Random类、随机数
    【Android】9.0活动的生命周期(二)——实际代码演示
    【Android】8.0活动的生命周期(一)——理论知识、活动的启动方式
  • 原文地址:https://www.cnblogs.com/storymedia/p/4538861.html
Copyright © 2020-2023  润新知