当前位置:操作系统 > Unix/Linux >>

dataifle误删除的模拟recover

dataifle误删除的模拟recover
 
Oracle 恢复试习一: 
 1. 热备份tablespace users. 
  2. a) scott login, 
     b) create table tt( seq number); 
     c) declare 
          i number; 
        begin 
          for i in 1..20 
          loop 
             insert into tt values(i); 
          end loop; 
          commit; 
        end; 
      d) alter system switch logfile; 
      e) insert into tt values(21); 
         alter system switch logfile; 
         ... 
         直到所有online redo file都做了archived(测试archived log的应用) 
      f) commit; 
   3. shutdown immediate; 
   4. rm datafile users; 
 
恢复如下: 
SQL> startup 
ORACLE instance started. 
 
Total System Global Area  285212672 bytes 
Fixed Size     1218992 bytes 
Variable Size   121636432 bytes 
Database Buffers  159383552 bytes 
Redo Buffers     2973696 bytes 
Database mounted. 
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file 
ORA-01110: data file 4: '/oracle/oracle/product/10.2.0/oradata/orcl/users01.dbf' 
 
SQL> host cp /oracle/backup/users01.dbf /oracle/oracle/product/10.2.0/oradata/orcl/ 
 
SQL> alter database open; 
alter database open 
ERROR at line 1: 
ORA-01113: file 4 needs media recovery 
ORA-01110: data file 4: '/oracle/oracle/product/10.2.0/oradata/orcl/users01.dbf' 
 
SQL> recover tablespace users; 
ORA-00279: change 546700 generated at 05/14/2013 20:51:07 needed for thread 1 
ORA-00289: suggestion : /oracle/oracle/product/10.2.0/db_1/flash_recovery_area/ORCL/archivelog/2013_05_14/o1_mf_1_6_%u_.arc 
ORA-00280: change 546700 for thread 1 is in sequence #6 
 
--- ORA-00289 :寻archived log file恢复...因为 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL} 
 
Log applied. 
Media recovery complete. 
SQL> alter database open; 
 
Database altered. 
 
注: 
scn的查看: 
1.select file#,checkpoint_change# from v$datafile_header; 
2.select file#,checkpoint_change# from v$datafile; 
  v$datafile_header的信息来自各数据文件的文件头. 
  v$datafile的信息则来自control file 
3.select sequence#,first_change#,next_change# from v$archived_log; 
4.select dbms_flashback.get_system_change_number from dual;-- system scn 
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,