您的位置:首页 > 其它

删除数据文件后恢复——小实验

2011-11-25 09:29 260 查看
SYS@orcl> create tablespace testspace datafile 'D:\testdatafile' size 10M

SYS@orcl> create table scott.testtable(id varchar2(16)) tablespace testspace;

SYS@orcl> insert into scott.testTable(id) values(1234567);

SYS@orcl> insert into scott.testTable(id) values(123456789);

SYS@orcl> commit;

SYS@orcl> select * from scott.testtable;

ID
----------------
1234567
123456789

SYS@orcl> alter tablespace testspace offline;

删除D:\testdatafile数据文件

SYS@orcl> recover tablespace testspace;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 7: 'D:\TESTDATAFILE'
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: 'D:\TESTDATAFILE'

SYS@orcl> alter database create datafile 7;

SYS@orcl> recover datafile 7;

SYS@orcl> select * from scott.testtable;
select * from scott.testtable
*
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7: 'D:\TESTDATAFILE'

SYS@orcl> alter tablespace testspace online;

SYS@orcl> select * from scott.testtable;

ID
----------------
1234567
123456789

SYS@orcl>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: