ORA-01157: cannot identify/lock data file string - see DBWR trace file

ORA-01157: cannot identify/lock data file string - see DBWR trace file
Cause: The background process was either unable to find one of the data files or failed to lock it because the file was already in use. The database will prohibit access to this file but other files will be unaffected. However the first instance to open the database will need to access all online data files. Accompanying error from the operating system describes why the file could not be identified.
Action: Have operating system make file available to database. Then either open the database or do ALTER SYSTEM CHECK DATAFILES.

Reference: http://docs.oracle.com/cd/B28359_01/server.111/b28278/e900.htm#ORA-01157

ORA-01157 is raised when Database Writer (DBWR) is unable to find and lock a Datafile. This may be due to various reasons like
- Datafile is deleted or corrupt
- Datafile is renamed or moved
- Mount point is incorrect
- Issues with Read/write permission on Datafile

To solve ORA-01157 we can use one of the following steps:
- If datafile is deleted or corrupt and is not of TEMP or UNDO tablespace then we need to recoved it by using a valid backup.
- If datafile is deleted or corrupt and is not of TEMP or UNDO tablespace but that tablespace do not containt important segments, that can be dropped offline
- If datafile is renamed or moved then we need to get it in its original position
- If Mount point is incorrect, simply recreate the mount point
- if it is due to permission then we need to grant the permission at OS level

I faced ORA-01157 at my local environment, when I was restoring a cold backup. Fortunatially it was with a tablespace which was added for testing purpose and was not critical. So I simply drop the datafile using "OFFLINE DROP" clause and opened the database.

C:\>sqlplus sys/sys as sysdba
SQL*Plus: Release Production on Tue Apr 30 19:07:16 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup
ORACLE instance started.
Total System Global Area  778387456 bytes
Fixed Size                  1384856 bytes
Variable Size             520097384 bytes
Database Buffers          251658240 bytes
Redo Buffers                5246976 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 11 – see DBWR trace file
ORA-01110: data file 16: 'E:\oracle\app\nimish.garg\oradata\orcl\test_ts.dbf'

SQL> select NAME from v$datafile where file#=16;

SQL> alter database datafile 16 OFFLINE DROP;
Database altered.

SQL> alter database open;
Database altered.

I hope this solution is helpful in solving your problem. Your comments are well appreciated.

Related Posts:
- ORA-00849: SGA_TARGET cannot be set to more than MEMORY_MAX_TARGET
- ORA-27101: shared memory realm does not exist
- ORA-00604: error occurred at recursive SQL level string
- ORA-00600: internal error code
- ORA-00257: archiver error. Connect internal only, until freed
- ORA-16000: database open for read-only access


  1. Thank you for very useful post. I believe this is exactly the real world problem analysis and solution that makes Oracle DBA community so professional. Likely this post will be found when some non-DBA needs solution to ORA-01157 very clear and in two-stepss. Well done.

  2. This worked like charm, gr8 buddy

  3. thanks for the solution. It worked for me.

  4. Thank you, this helped me get my Oracle test server back up and running after I deleted several .DBF files from tablespaces I had already dropped. Oracle apparently still considered the data files to be in use.

  5. Thank you! Great post helped me quickly get my test server back up.

  6. Excellent! It worked.

  7. Thanks for the clearcut solution. With all the grabage floating all over the internet, this piece of work is quite admirable. Thanks, it saved a lot of time which could have been wasted going to those overrated sites and looking at all those troll posts.

  8. That was very helpful thanksπŸ˜„πŸ˜„πŸ˜„πŸ˜„


  9. SQL> alter database open;
    alter database open
    ERROR at line 1:
    ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

    1. same error i am getting.
      how you solve your issue.

  10. Great article, it really helped me out!

  11. Excellent, saved me lot of time. Thank you!

  12. thanks for the solution. It worked for me.

  13. Saved me a lot of time. Thank you!

  14. What should we do when same error occurs in system datafile?

    1. I Also have the same error on system datafile. Anyone with solution?

  15. Thanks it's work

  16. So my query was: Does it really matter?

  17. Hello, I read your blog like every week. Your writing style is
    witty, keep up the good work!

  18. Excellent site. Lots of useful info here. I'm sending it to some pals
    ans also sharing in delicious. And naturally, thank you on your

  19. Same issue for system01 datafile.
    So can't follow to drop this datafile and open database.
    Please help.

  20. What's up to every one, the contents present at this web site
    are really amazing for people experience, well,
    keep up the good work fellows.

  21. It is all in the presentation and digital
    technology in the boardroom is vital to the success of any business.