zoukankan      html  css  js  c++  java
  • rman恢复实践

    1) Loss of system DATAFILE
    2) Loss of non-system DATAFILE
    3) Loss of a DATAFILE without Backup
    4) Loss of a CONTROLFILE
    5) Loss of all the CONTROLFILE
    6) Loss of REDOLOGs
    7) Loss of CONTROLFILE, SPFILE, DATAFILEs and REDOLOGs
    8) Loss of Tempfile
    9) Block corruption of datafiles

    1) Loss of system DATAFILE
    rm -rf /u01/app/oracle/oradata/PROD1/system01.dbf
    $rman target /
    rman>validate database;
    rman>shutdown abort
    rman>startup mount
    rman>restore datafile 1;
    rman>recover datailfe 1;
    rman>alter database open;
    rman>validate database;
     
    2) Loss of non-system DATAFILE
    $rman target /
    rman>validate database;
    rman>list failure;
    rman>advise failure;
    rman>repair failure preview;
    rman>repair failure;
    rman>validate database;
     
    3) Loss of a DATAFILE without Backup
    $rman target /
    rman>validate database;
    rman>list failure;
    rman>advise failure;
    rman>repair failure preview;
    rman>repair failure;
    rman>validate database;
     
    4) Loss of a CONTROLFILE
    rm -rf /u01/app/oracle/oradata/PROD1/control01.ctl
    sql>shutdown immediate
    cp -r /u01/app/oracle/fast_recovery_area/PROD1/control02.ctl /u01/app/oracle/oradata/PROD1/control01.ctl 
    sql>startup nomount
    sql>alter system set control_files='/u01/app/oracle/oradata/PROD1/control01.ctl','/u01/app/oracle/fast_recovery_area/PROD1/control02.ctl' scope=spfile;
    sql>startup force
    sql>select name from v$instance;
     
    5) Loss of all the CONTROLFILE

    rm /u01/app/oracle/oradata/PROD1/control01.ctl

    rm /u01/app/oracle/fast_recovery_area/PROD1/control02.ctl

    alter system switch logfile;
    shutdown abort
    -- Run the following script from RMAN
    sqlplus rman/rman@emrep
    SQL> select * from rc_database; --获取该 DB 的 dbid(例如: 1583199105)
    rman target / catalog rman/rman@emrep
    RMAN> set dbid = 1583199105;
    RMAN> startup nomount;
    RMAN> restore controlfile from autobackup;
    RMAN> sql 'alter database mount';
    RMAN> restore database;
    RMAN> recover database;
    RMAN> sql 'alter database open resetlogs';
    new incarnation of database registered in recovery catalog
    RMAN> list incarnation;
     
    6) Loss of REDOLOGs

    shutdown immediate;

    startup

    sqlplus / as sysdba
    startup mount;
    -- Clear all the redo logfiles
    alter database clear unarchived logfile group 1;
    alter database clear unarchived logfile group 2;
    alter database clear unarchived logfile gorup 3;
    alter database open;
     
    7) Loss of CONTROLFILE, SPFILE, DATAFILEs and REDOLOGs
    shutdown abort
    sqlplus rman/rman@emrep
    select * from rc_database;
    RMAN>SET DBID=*****
    RMAN>STARTUP NOMOUNT
     
    ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=4G;
    ALTER  SYSTEM  SET  DB_RECOVERY_FILE_DEST='/u01/app/oracle/fast_recovery_area'; 
     
    RMAN>RESTORE SPFILE FROM AUTOBACKUP;
    RMAN>SHUTDOWN IMMEDIATE
    RMAN>STARTUP NOMOUNT
    RMAN>RESTORE CONTROLFILE FROM AUTOBACKUP;
    RMAN>ALTER DATABASE MOUNT;
     
    alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
    select thread#, resetlogs_change#, archived, sequence#, completion_time from v$archived_log
    where archived='YES' AND COMPLETION_TIME = (SELECT MAX(COMPLETION_TIME)
    FROM V$ARCHIVED_LOG WHERE ARCHIVED='YES');
     

    -- In RMAN, recovered until the last ARCHIVE LOG (n+1) and open with RESETLOGS

    -- If the last created archived redo log has sequence n,

    -- then specify UNTIL SEQUENCE n+1 so that RMAN applies n and then stops.

     
    restore database until sequence 3 thread 1;
    recover database until sequence 3 thread 1;
    alter database open resetlogs;
     
    8) Loss of Tempfile
    sql>shutdown immediate
    sql>startup
    oracle 11g丢失临时表空间文件,重启后会自动创建临时表空间文件
     
    9) Block corruption of datafiles
    $rman target / catalog rman/rman@emrep
    RMAN> list failure;
    RMAN> advise failure;
    RMAN> repair failure;
    -- Check the result
    RMAN> list failure all;

  • 相关阅读:
    正试图在 os 加载程序锁内执行托管代码。不要尝试在 DllMain 或映像初始化函数内运行托管代码,这样做会导致应用程序挂起。问题的解决方法!
    ArcGIS10 图框生成和批量打印工具V5.0正式发布
    c# winform未能找到引用的组件“Excel”的解决办法
    图框工具5.0 for ArcGIS10正式发布
    python UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2: ordinal not in range(128)错误解决办法
    ArcGIS地图文档MXD效率慢的一点建议(转)
    ArcGISEngine实现图层输出kml
    云南云测采用本人开发所有权辅助建库软件,获得好评
    瑞星发力高端企业级市场 连续中标政府大单 狼人:
    臭名昭著的十种Web恶意攻击软件 狼人:
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/10278017.html
Copyright © 2011-2022 走看看