检查数据文件的位置如下:
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/Oracle/oradata/marven/system01.dbf
/u01/app/oracle/oradata/marven/undotbs1.dbf
/u01/app/oracle/oradata/marven/sysaux01.dbf
/u01/app/oracle/oradata/marven/users01.dbf
/u01/app/oracle/oradata/marven/marven01.dbf
SQL> !rm /u01/app/oracle/oradata/marven/*.dbf
创建表发生报错
SQL> create table test2 as select * from dba_tables;
create table test2 as select * from dba_tables
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/marven/system01.dbf'
ORA-27041: unable to open file
Linux-
Additional information: 3
SQL> !
这个时候千万不要关闭实例,检查进程dbwr进程的PID:
[oracle@hpserver2 dbs]$ ps -ef|grep dbw
oracle 9451 1 0 17:08 ? 00:00:00 ora_dbw0_marven
[oracle@hpserver2 dbs]$ cd /proc/9451[oracle@hpserver2 ~]$ cd /proc/9451/fd
[oracle@hpserver2 fd]$ ls -lrt
total 0
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_marven.dat
l-wx------ 1 oracle oinstall 64 Jan 30 17:18 8 -> /u01/app/oracle/admin/marven/bdump/alert_marven.log
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstmarven (deleted)
l-wx------ 1 oracle oinstall 64 Jan 30 17:18 6 -> /u01/app/oracle/admin/marven/bdump/alert_marven.log
l-wx------ 1 oracle oinstall 64 Jan 30 17:18 5 -> /u01/app/oracle/admin/marven/udump/marven_ora_9443.trc
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 24 -> /u01/app/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 23 -> /u01/app/oracle/oradata/marven/temp02.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 22 -> /u01/app/oracle/oradata/marven/marven01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 21 -> /u01/app/oracle/oradata/marven/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 20 -> /u01/app/oracle/oradata/marven/sysaux01.dbf (deleted)
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 2 -> /dev/null
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 19 -> /u01/app/oracle/oradata/marven/undotbs1.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 18 -> /u01/app/oracle/oradata/marven/system01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 17 -> /u01/app/oracle/oradata/marven/control03.ctl
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 16 -> /u01/app/oracle/oradata/marven/control02.ctl
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 15 -> /u01/app/oracle/oradata/marven/control01.ctl
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkMARVEN
lrwx------ 1 oracle oinstall 64 Jan 30 17:18 13 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_marven.dat
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 11 -> /u01/app/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 10 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Jan 30 17:18 0 -> /dev/null
将数据文件复制回去
[oracle@hpserver2 fd]$ cp 23 /u01/app/oracle/oradata/marven/temp02.dbf
[oracle@hpserver2 fd]$ cp 22 /u01/app/oracle/oradata/marven/marven01.dbf
[oracle@hpserver2 fd]$ cp 21 /u01/app/oracle/oradata/marven/users01.dbf
[oracle@hpserver2 fd]$ cp 20 /u01/app/oracle/oradata/marven/sysaux01.dbf
[oracle@hpserver2 fd]$ cp 19 /u01/app/oracle/oradata/marven/undotbs1.dbf
[oracle@hpserver2 fd]$ cp 18 /u01/app/oracle/oradata/marven/system01.dbf
将实例关闭后做介质恢复:
ora-03113: end-of-file on communication channel
SQL> SQL> conn /as sysdba
Connected to an idle instance.
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.
SQL> recover database;
Media recovery complete.
数据库可以正常打开额,当然由于我这测试库几乎无事务,所以不用太多的复制操作即可完成
SQL> alter database open;
Database altered.