ORA-01157报错"cannot identify/lock data file"解决

Posted 星火spark

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORA-01157报错"cannot identify/lock data file"解决相关的知识,希望对你有一定的参考价值。

 

 
sqlplus以管理员方式接入数据库,启动时出现报错,如下:
> sqlplus "/as sysdba"
SQL> startup
......
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: ‘/tmp/test.dbf‘
 
查看数据库日志文件alert_$ORACLE_SID.log,存在对应报错信息:
Errors in file ....../aix85_psp0_454886.trc:
查看此trc文件中记录信息:
*** SERVICE NAME:() 2011-07-18 10:05:00.769
*** SESSION ID:(332.1) 2011-07-18 10:05:00.769
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: ‘/tmp/test.dbf‘
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
ORA-01110: data file 9: ‘/tmp/test1.dbf‘
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 10 - see DBWR trace file
ORA-01110: data file 10: ‘/tmp/indx1.dbf‘
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 11 - see DBWR trace file
ORA-01110: data file 11: ‘/tmp/test2.dbf‘
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 12 - see DBWR trace file
 
查询分析:
查看/tmp目录中已经没有任何dbf文件存在,查询确认/tmp目录中的几个dbf是在之前数据库运行过程中添加的测试空间文件,测试完毕已经删除,而且后续没有任何人访问到这几个文件,因此也没有任何数据库报错,直到数据库实例宕掉并重启时出现启动失败。
 
解决办法:
既然出现报错的几个dbf文件已经不用,则解决办法相对简单,只要将对应的数据文件删除,并继续删除对应新增的表空间即可。操作过程如下:
SQL> shutdown immediate;
SQL> startup mount;
SQL> select file#,name,status from v$datafile;
SQL> alter database datafile ‘/tmp/test.dbf‘ offline drop;      //此处若不加drop会报错
再次查看v$datafile表会发现对应的几个dbf文件状态由ONLINE变为RECOVER
SQL> select * from v$tablespace;
SQL> drop tablespace test including contents cascade constraints;
......
删除完毕,再次执行startup成功。

以上是关于ORA-01157报错"cannot identify/lock data file"解决的主要内容,如果未能解决你的问题,请参考以下文章

原创oracle ORA-01157 ORA-01110 DataGuard 备库 临时表空间报错

11.2.0.3升级到11.2.0.4报错ORA-01157 ORA-01110

ORA-01110 ORA-01111 ORA-01157主备库数据文件路径路径不一致,备库开启ADG应用报错(一切都是套路)

11g rac ORA-01157问题处理

ORA-01157 错误解决方法

记一次Oracle启动报错问题解决