zoukankan      html  css  js  c++  java
  • ORA01157报错"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成功。

  • 相关阅读:
    SQL易错总结1
    线程池使用总结
    多线程的上下文切换
    SQL 排序按指定内容优先排序
    System x 服务器制作ServerGuide U盘安装Windows Server 2008 操作系统 --不格式化盘
    错误“该伙伴事务管理器已经禁止了它对远程/网络事务的支持”解决方案
    sql server 2012 链接服务器不能链接sql server 2000的解决方案 ,
    sqlserver2005版本的mdf文件,还没有log文件,
    BCP SQL导出EXCEL常见问题及解决方法;数据导出存储过程
    Nginx
  • 原文地址:https://www.cnblogs.com/arcer/p/3120209.html
Copyright © 2011-2022 走看看