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;

  • 相关阅读:
    用instr 直接取最右端的点的位置:
    ASP FSO操作文件(复制文件、重命名文件、删除文件、替换字符
    Ubuntu 16.04系统下安装RapidSVN版本控制器及配置diff,editor,merge和exploer工具
    Ubuntu 16.04系统下开机提示“无法应用原保存的显示器配置”
    Ubuntu 16.04系统下出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
    Ubuntu 16.04系统下软件中心Software闪退解决办法
    UEditor富文本WEB编辑器自定义默认值设置方法
    HTML5 移动页面自适应手机屏幕四类方法
    Ubuntu 16.04系统下apt-get和dpkg区别
    jQuery相同id元素 全部获取问题解决办法
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/10278017.html
Copyright © 2011-2022 走看看