在Linux下删掉了数据文件,恢复数据库
物理删除了数据文件,导致数据库开启报错
ERROR at line 1:
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: ‘/home/oracletest/test41/soe41.dbf’
解决方案
如果表空间中还有其他数据文件能正常使用,这时我们就将损坏的数据文件脱机
SYS@ORCL>alter database datafile 5 offline drop; 5就是上面的data file 5
Database altered.
将损坏的数据文件脱机后,就不会在影响数据库的打开了,现在打开数据库
SYS@ORCL>alter database open;
Database altered.
SYS@ORCL>select ts#,file#,name from v$datafile;
TS# FILE# NAME
——————————————
0 1 /u01/app/oracle/oradata/ORCL/system01.dbf
1 2 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
2 3 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
4 4 /u01/app/oracle/oradata/ORCL/users01.dbf
6 5 /u01/app/oracle/oradata/ORCL/example01.dbf
8 6 /u01/app/oracle/oradata/ORCL/tyger01.dbf6 rows selected.
SYS@ORCL>select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
SOE411 ONLINE
7 rows selected.
SYS@ORCL>drop tablespace SOE411 including contents and datafiles
Tablespace dropped.
SYS@ORCL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@ORCL>startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 130025040 bytes
Database Buffers 150994944 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.