• 手工完全恢复(将数据文件恢复到新的位置)


    实验环境:red hat 5.8

    oracle环境:11.2.0.3

    只坏一个文件

    实验前先备份

    使用脚本,冷备份和热备份

    冷备份参考:http://blog.csdn.net/rlhua/article/details/11850445

    热备份参考:http://blog.csdn.net/rlhua/article/details/11850629

    1、首先建立一张测试用的表。

    sys@TEST0910> conn scott/tiger
    Connected.
    scott@TEST0910> create table test4 as select * from emp;
    Table created.

    2、插入三次数据,分别为提交归档,提交不归档,不提交不归档

    sys@TEST0910> insert into scott.test4 select * from scott.emp;
    14 rows created.
    sys@TEST0910> commit;
    Commit complete.
    sys@TEST0910> alter system archive log current;
    System altered.
    sys@TEST0910> select count(*) from scott.test4;
      COUNT(*)
    ----------
            28
    sys@TEST0910> insert into scott.test4 select * from scott.emp;
    14 rows created.
    sys@TEST0910> commit;
    Commit complete.
    sys@TEST0910> select count(*) from scott.test4;
      COUNT(*)
    ----------
            42
    sys@TEST0910> insert into scott.test4 select * from scott.emp;
    14 rows created.
    sys@TEST0910>  select count(*) from scott.test4;
      COUNT(*)
    ----------
            56

    3、模拟断电。

    sys@TEST0910> shutdown abort;
    ORACLE instance shut down.
     
    4、删除数据文件
    [oracle@rtest ~]$ rm /u01/app/oracle/oradata/test0910/users01.dbf
     
    5、起库,报错,查询哪个文件损坏。
    sys@TEST0910> startup
    ORACLE instance started.
    Total System Global Area 2505338880 bytes
    Fixed Size                  2230952 bytes
    Variable Size             587203928 bytes
    Database Buffers         1895825408 bytes
    Redo Buffers               20078592 bytes
    Database mounted.
    ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
    ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'
    sys@TEST0910> select file#,error from v$recover_file;
         FILE# ERROR
    ---------- -----------------------------------------------------------------
             4 FILE NOT FOUND
     
    6、使用高可用模式,先开库,后恢复
    先让datafile offline
    sys@TEST0910> alter database datafile 4 offline;
    Database altered.
    sys@TEST0910> alter database open;
    Database altered.
     
    7、转储到新的位置
     
     
    [oracle@rtest disk1]$  cp /u01/app/oracle/bak/hot_bak/users01.dbf /u01/app/oracle/oradata/test0910/disk1/users01.dbf
    [oracle@rtest disk1]$ ls
    users01.dbf

    8、使用rename改变位置

    sys@TEST0910> alter database rename file '/u01/app/oracle/oradata/test0910/users01.dbf' to  '/u01/app/oracle/oradata/test0910/disk1/users01.dbf';
    Database altered.
     
    9、恢复数据文件,容乃公数据文件online
    sys@TEST0910> recover datafile 4;
    ORA-00279: change 1647795 generated at 09/19/2013 20:16:10 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_19/o1_mf_1_39_93q4z4lt_.arc
    ORA-00280: change 1647795 for thread 1 is in sequence #39
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    auto
    ORA-00279: change 1648611 generated at 09/19/2013 20:16:35 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_19/o1_mf_1_40_93qc5g30_.arc
    ORA-00280: change 1648611 for thread 1 is in sequence #40
    ORA-00279: change 1656909 generated at 09/19/2013 22:02:21 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_41_93rysdc1_.arc
    ORA-00280: change 1656909 for thread 1 is in sequence #41
    ORA-00279: change 1682384 generated at 09/20/2013 12:43:24 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_42_93ryywvd_.arc
    ORA-00280: change 1682384 for thread 1 is in sequence #42
    ORA-00279: change 1682485 generated at 09/20/2013 12:46:20 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_43_93s0lg0r_.arc
    ORA-00280: change 1682485 for thread 1 is in sequence #43
    ORA-00279: change 1702534 generated at 09/20/2013 13:13:48 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_44_93s106lj_.arc
    ORA-00280: change 1702534 for thread 1 is in sequence #44
    ORA-00279: change 1703113 generated at 09/20/2013 13:21:10 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_45_93s1bwhd_.arc
    ORA-00280: change 1703113 for thread 1 is in sequence #45
    ORA-00279: change 1723137 generated at 09/20/2013 13:26:52 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_46_93s2kccp_.arc
    ORA-00280: change 1723137 for thread 1 is in sequence #46
    ORA-00279: change 1724278 generated at 09/20/2013 13:47:23 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_47_93s32w3k_.arc
    ORA-00280: change 1724278 for thread 1 is in sequence #47
    ORA-00279: change 1744396 generated at 09/20/2013 13:56:43 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_48_93ss22cp_.arc
    ORA-00280: change 1744396 for thread 1 is in sequence #48
    ORA-00279: change 1758153 generated at 09/20/2013 20:11:45 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_20/o1_mf_1_49_93szgs9j_.arc
    ORA-00280: change 1758153 for thread 1 is in sequence #49
    ORA-00279: change 1766481 generated at 09/20/2013 22:00:56 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_21/o1_mf_1_50_93tvkm26_.arc
    ORA-00280: change 1766481 for thread 1 is in sequence #50
    ORA-00279: change 1783681 generated at 09/21/2013 06:00:18 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_21/o1_mf_1_51_93vdmv7w_.arc
    ORA-00280: change 1783681 for thread 1 is in sequence #51
    ORA-00279: change 1792730 generated at 09/21/2013 10:51:38 needed for thread 1
    ORA-00289: suggestion :
    /u01/app/oracle/fast_recovery_area/TEST0910/archivelog/2013_09_21/o1_mf_1_52_93vdzvnf_.arc
    ORA-00280: change 1792730 for thread 1 is in sequence #52
    Log applied.
    Media recovery complete.
    sys@TEST0910> alter database datafile 4 online;
    Database altered.
    sys@TEST0910> select count(*) from scott.test4;
      COUNT(*)
    ----------
            42
  • 相关阅读:
    合唱队形2 洛谷U5874
    AC日记——石子归并 codevs 1048
    AC日记——舒适的路线 codevs 1001 (并查集+乱搞)
    AC日记——导弹拦截 洛谷 P1020 (dp+模拟)
    常见模板(欧拉筛素数,最小生成树,快排,并查集,单源最短路)
    AC日记——信息传递 洛谷 P2661 (tarjan求环)
    AC日记——逃出克隆岛 (bfs)
    数字对 (长乐一中模拟赛day2T2)
    改造二叉树 (长乐一中模拟赛day2T1)
    AC日记——热浪 codevs 1557 (最短路模板题)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317210.html
Copyright © 2020-2023  润新知