zoukankan      html  css  js  c++  java
  • 没有备份、只有归档日志,如何恢复数据文件?


      系统环境:
      
      1、操作系统:Windows 2000 Server,机器内存128M
      2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版
      3、安装路径:C:\ORACLE
      
      模拟现象:
      
      可通过重建数据文件来恢复,前提是归档日志文件保存完整
      
      先将数据库设置为归档模式
      
      SQL*Plus
      
      conn system/manager
      
      --创建实验表空间
      
      create tablespace test datafile
      
      ’c:\test.ora’ size 5M
      
      AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED
      
      default storage (initial 128K next 1M pctincrease 0)
      
      /
      
      --创建实验用户
      
       drop user test cascade;
      
      create user test identified by test default tablespace test;
      
      grant connect,resource to test;
      
      conn test/test
      
      create table a(a number);
      
      insert into a values(1);
      
      insert into a select * from a; --反复插入,达到100万条 BBS.bitsCN.com网管论坛
      
      commit;
      
      --关闭数据库
      
      SVRMGR> connect internal
      
      SVRMGR> alter system switch logfile; --强制归档
      
      SVRMGR> alter system switch logfile;
      
      SVRMGR> alter system switch logfile;
      
      SVRMGR> shutdown
      
      --操作系统下删除test.ora文件
      
      --重新启动数据库
      
      SVRMGR> connect / as sysdba  
      SVRMGR> startup
      
      这时,可以mount上,但无法打开,因为数据文件test.ora不存在,
      
      显示错误如下:
      
      ORA-01157: ????/?????? 8 - ??? DBWR ????
      
      ORA-01110: ???? 8: ’C:\TEST.ORA’
      
      SVRMGR> connect / as sysdba
      
      SVRMGR> startup mount
      
      SVRMGR> alter database create datafile ’c: est.ora’;
      
      SVRMGR> set autorecovery on
      
      SVRMGR> recover datafile ’c: est.ora’;
      
      SVRMGR> alter database open;
      
      conn test/test
      
      select count(*) from a; --数据又恢复到100万条 bitsCN_com
      
      --删除实验表空间
      
      connect / as sysdba  

      alter tablespace test offline;
      
      drop tablespace test INCLUDING CONTENTS;
      
      drop user test;
      
      --如果是非归档模式,也可以运用以上方法,
      
      --前提是:输入记录所占空间的大小不超过所有联机日志文件的大小
      
      --即:用联机日志文件来恢复
  • 相关阅读:
    three.js cannon.js物理引擎之齿轮动画
    three.js cannon.js物理引擎之约束(二)
    three.js cannon.js物理引擎制作一个保龄球游戏
    three.js cannon.js物理引擎之制作拥有物理特性的汽车
    three.js cannon.js物理引擎之Heightfield
    three.js cannon.js物理引擎地形生成器和使用指针锁定控件
    three.js 之cannon.js物理引擎
    设计模式概述
    设计模式之单例模式
    java设计模式之抽象工厂
  • 原文地址:https://www.cnblogs.com/weixun/p/3273211.html
Copyright © 2011-2022 走看看