1、启动数据库报错 在启动数据库过程中,报了ORA-01157和ORA-01110错误,提示找不到数据文件。

SYS@gbktest>startup
ORACLE instance started.

Total System Global Area  810053632 bytes
Fixed Size		    2257600 bytes
Variable Size		  633343296 bytes
Database Buffers	  167772160 bytes
Redo Buffers		    6680576 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 28 - see DBWR trace file
ORA-01110: data file 28: '/db/app/oracle/oradata/gbktest/NX_QUESTIONNAIRE.dmp'


SYS@gbktest>select status from v$instance;
STATUS
------------------------------------
MOUNTED

由于数据库在启动过程中后台进程不能找到相应的数据文件或者不能锁定相应的数据文件,数据库将禁止访问这些数据文件而其他的数据文件则没有影响。ORA-01157错误一般和ORA-01110错误一起出现。

2、重启数据库到mount状态,删除数据文件 启动数据库时,nomount状态读取参数文件,mount状态读取控制文件,在mount状态下可以删除数据文件。

SYS@gbktest>startup nomount
ORACLE instance started.
Total System Global Area  810053632 bytes
Fixed Size		    2257600 bytes
Variable Size		  633343296 bytes
Database Buffers	  167772160 bytes
Redo Buffers		    6680576 bytes

SYS@gbktest>alter database mount;
Database altered.

SYS@gbktest>alter database datafile '/db/app/oracle/oradata/gbktest/NX_QUESTIONNAIRE.dmp' offline drop;
Database altered.

3、打开数据库,删除表空间 启动数据库到open状态,查找数据文件对应的表空间名称;然后,删除表空间。

SYS@gbktest>alter database open;
Database altered.

#查找数据文件对应的表空间名称
SYS@gbktest>select file_name,file_id,tablespace_name,STATUS,ONLINE_STATUS from dba_data_files;

#删除表空间
SYS@gbktest>drop tablespace tablespace_name including contents;
或
drop tablespace report12320 including contents and datafiles;

4、重启数据库 在进行上述操作后,重启数据库,确保数据库能够正常打开

SYS@gbktest>shutdown immediate

SYS@gbktest>startup