zoukankan      html  css  js  c++  java
  • Rman 管理 archivelog 的命令

      

    因为archivelog的相关信息是记录在controlfile中的,当物理删除后不会改变controlfile的设置。并且在查询相关的动态视图(例如v$archived_log)时,该部分日志仍然标注为存在,也就是说

    Oracle并不认为这些日志被删除了。

    这种错误信息会导致在rman在备份archivelog终止,出现不能完成备份,并且阻塞后续的备份操作。

    一、直接使用RMAN删除archivelog
    RMAN>crosscheck  archivelog all;
    RMAN>delete noprompt archivelog until time 'sysdate-3';
    删除三天前的归档日志,不经过提示、直接删除。

    或者
    RMAN>delete archivelog all completed before 'sysdate3';

    二、使用RMAN备份archivelog之后,进行删除动作。
    RMAN>backup format '/backup/archlog_%T_%s_%U' archivelog all delete input;


    RMAN>backup format '/backup/archlog_%T_%s_%U' archivelog all delete all input;
    这个表示备份所有的archivelog之后,删除所有路径下archivelog 因为有些库的archivelog 是多份的。

    或者在备份database的语句中加上plus archivelog;
    RMAN>backup database plus archivelog;

    三、如果是在OS层手工进行了archivelog或者文件丢失。
    先进行archivelog 交叉检查
    RMAN>crosscheck archivelog all;
    RMAN>delete noprompt expired archivelog all;

    四、查出某个时间段所涉及到的archivelog;
    RMAN>list backup of archivelog time between "to_date('2012-04-12 12:00:00','yyyy-mm-dd,hh24:mi:ss')"  and "to_date('2012-04-25 12:00:00','yyyy-mm-dd hh24:mi:ss')";

    根据以上查出的类容,我们就可以通过备份还原出archivelog
    RMAN>restore archivelog from logseq 11111 until logseq 11150;

    五、与archivelog相关的命令

    RMAN>crosscheck archivelog all;        -----交叉检查归档日志信息。
    RMAN>list expired archivelog all;         -----列出所有过期的归档日志信息。
    RMAN>list archivelog all;                -----查看当前归档日志列表信息。
    RMAN>list archivelog from time='sysdate-2';       -----查看至今两天的日志信息。
    RMAN>backup archivelog all  format '/u03/rman/arch_log_%d_%T_%s_%p';           -------备所有归档。
    RMAN>backup as compressed backupset  archivelog all  format '/u03/rman/arch_log_%d_%T_%s_%p';       -------采用压缩,备所有归档。
    RMAN>backup archivelog from time 'sysdate-3';       -------备份3天以来的归档日志。
    RMAN>backup archivelog from sequence 5;       -------从日志序列是5的开始备份。
    RMAN>backup archivelog from sequence 5 until sequence 10;     -------备份日志序列从5到10的日志。
    RMAN>backup archivelog all delete all input;       --------备份完所有的日志后,删除所有归档目录的日志。
    RMAN>delete noprompt expired archivelog all;       --------删除过期的archivelog
    RMAN>restore archivelog all;         --------还原所有的archivelog日志
    RMAN>restore archivelog all preview;        --------不真实还原,只是预览操作
    RMAN>delete  archivelog all;         --------删除所有的archivelog日志
    RMAN>restore archivelog from logseq 11111 until logseq 11150;     -------还原某个段的archivelog日志
    RMAN>restore archivelog from sequence 36 until sequence 50;
    RMAN>restore archivelog low sequence 36 high sequence 50;
    RMAN>restore archivelog time between "to_date('2012-04-22 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2012-04-26 16:20:00','yyyy-mm-dd hh24:mi:ss')" preview;
    RMAN>restore archivelog time between "to_date('2012-04-22 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2012-04-26 16:20:00','yyyy-mm-dd hh24:mi:ss')" ;

    指定archivelog的恢复目的地,如你想把archivelog恢复到一个临时目录时有用
    RMAN>run {
    set archivelog destination to '/home/temp';
    }

  • 相关阅读:
    关于 flutter_boost Attempt to invoke virtual method ' com.idlefish.flutterboost.FlutterViewContainerManager.getCurrentTopRecord()' on a null object reference
    关于 flutter_boost TextField的autofocus导致页面闪动回弹
    关于 flutter ios打开一个带有百度地图的native页面闪退Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread
    关于 flutter_boost demo 隐藏导航栏后push flutter page 右滑返回失效
    关于 flutter 只能用armeabi单架构的问题
    关于数组的length属性
    python 常见问题:导入py文件易忽略问题
    IE浏览器兼容性测试 文档模式,浏览器模式
    关于事件mouseover ,mouseout ,mouseenter,mouseleave的区别
    [BS-28] iOS中分页的几种算法
  • 原文地址:https://www.cnblogs.com/lucifa/p/10552797.html
Copyright © 2011-2022 走看看