首页 > 数据库 > Oracle > 没有备份的数据文件恢复(五)
环境:某个数据文件因操作系统错误删除原因被删除而且无任何备份,数据库运行在归档模式下,该数据文件创建时间晚于于控制文件创建时间。
[oracle@dbserv ~]$ sqlplus / as sysdba
SQL> create tablespace test datafile '/opt/oracle/oradata/test/test01.dbf' size 100M;
Tablespace created.
SQL> create table ttt tablespace test as select * from dba_users;
Table created.
SQL> select count(*) from ttt;
COUNT(*)
----------
8
SQL> insert into ttt select * from dba_users;
8 rows created.
SQL> /
8 rows created.
SQL> /
8 rows created.
SQL> commit;
Commit complete.
SQL> alter system archive log current;
System altered.
[@more@]SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
因操作失误原因test数据文件被删除而且没有备份:
SQL> host rm -f /opt/oracle/oradata/test/test01.dbf
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 1220432 bytes
Variable Size 486539440 bytes
Database Buffers 1644167168 bytes
Redo Buffers 15556608 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/opt/oracle/oradata/test/test01.dbf'
SQL> recover datafile;
ORA-02236: invalid file name
SQL> recover datafile 5;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 5: '/opt/oracle/oradata/test/test01.dbf'
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/opt/oracle/oradata/test/test01.dbf'
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 5: '/opt/oracle/oradata/test/test01.dbf'
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/opt/oracle/oradata/test/test01.dbf'
SQL> alter database create datafile '/opt/oracle/oradata/test/test01.dbf' ;
Database altered.
SQL> recover datafile 5;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select count(*) from ttt;
COUNT(*)
----------
32
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/18841027/viewspace-1058662/ ,如需转载,请注明出处,否则将追究法律责任。