SQL> create tablespace testtbs datafile 'D:\oracle\oradata\ora9i\testtbs.dbf' size 1m;
SQL> alter system switch logfile;
SQL> create table scott.com4 (n1 number) tablespace testtbs;
SQL> alter system switch logfile;
SQL> insert into scott.com4 values(1);
SQL> commit;
SQL> alter system switch logfile;
假设 testtbs.dbf坏了
我这里采取的办法是先将testtbs.dbf指向另外一个目录。
SQL> alter tablespace testtbs offline immediate;
SQL> alter database create datafile 'D:\oracle\oradata\ora9i\testtbs.dbf' as
'D:\oracle\oradata\ora9i\u1\testtbs1.dbf';
SQL> select * from scott.com4;
select * from scott.com4
*
ERROR 位于第 1 行:
ORA-00376: 此时无法读取文件 13
ORA-01110: 数据文件 13: 'D:\ORACLE\ORADATA\ORA9I\U1\TESTTBS1.DBF'
恢复
RMAN> run{
2> set newname for datafile 13 to 'D:\oracle\oradata\ora9i\u1\testtbs1.dbf';
3> }
RMAN> recover tablespace testtbs ;
SQL> alter tablespace testtbs online;
SQL> select * from scott.com4;
N1
----------
1
阅读(2165) | 评论(0) | 转发(0) |