Oracle Error ORA-01157: cannot identify/lock data file string

Posted on

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.

Leave a Reply

Your email address will not be published. Required fields are marked *