Chinaunix首页 | 论坛 | 博客
  • 博客访问: 754368
  • 博文数量: 803
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 5015
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 10:29
文章分类

全部博文(803)

文章存档

2011年(1)

2008年(802)

我的朋友

分类:

2008-10-29 11:42:37


  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万条
  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 internal
  SVRMGR> startup
  
  这时,可以mount上,但无法打开,因为数据文件test.ora不存在,
  显示错误如下:
  
  ORA-01157: ????/?????? 8 - ??? DBWR ????
  ORA-01110: ???? 8: 'C:\TEST.ORA'
  
  SVRMGR> connect internal
  SVRMGR> startup mount
  SVRMGR> alter database create datafile 'c:\test.ora';
  SVRMGR> set autorecovery on
  SVRMGR> recover datafile 'c:\test.ora';
  SVRMGR> alter database open;
  
  conn test/test
  select count(*) from a; 数据又恢复到100万条
  
  删除实验表空间
  conn system/manager
  alter tablespace test offline;
  drop tablespace test INCLUDING CONTENTS;
  drop user test;
  
  如果是非归档模式,也可以运用以上方法,
  前提是:输入记录所占空间的大小不超过所有联机日志文件的大小
  即:用联机日志文件来恢复
  
【责编:admin】

--------------------next---------------------

阅读(453) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~