Oracle Error 01157
Contents |
SQL TuningSecurityOracle UNIXOracle LinuxMonitoringRemote supportRemote plansRemote servicesApplication Server ApplicationsOracle FormsOracle PortalApp UpgradesSQL ServerOracle ConceptsSoftware SupportRemote Support Development Implementation Consulting StaffConsulting PricesHelp Wanted! ora-01157 cannot identify/lock data file tempfile Oracle PostersOracle Books Oracle Scripts Ion Excel-DB Don Burleson ora-01157 cannot identify/lock data file 6 - see dbwr trace file Blog
ORA-01157 tips Oracle ora 01157 ora 01110 system01 dbf Database Tips by Burleson Consulting December 15, 2015 Question: I'm getting the ORA-01157 and ORA-01110 when trying to bring my tablespaces online: SQL> alter tablespaceOra-01157 Ora-01110 Solution
example online; alter tablespace example online * ERROR at line 1: ORA-01157: cannot identify/lock data file 5 - see DBWR trace file ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF' How do I fix this ORA-01157 error? Answer: First, the Oracle docs note this on the ORA-01157 error: ORA-01157: cannot identify/lock data file string - see ora-01157 cannot identify/lock data file standby 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.
As we see, the ORA-01157 is caused by a locking issue with the database writer (DBWR) background process. During a recovery, this can be caused by a unopened data files (i.e. database mounted but not open), a missing file, a permission problem in the file (e.g. no write permissions 770 on the files owned by Oracle). If the background process is unof 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 dbwr trace file location files will be unaffected. However the first instance to open the database
Alter System Check Datafiles
will need to access all online data files. Accompanying error from the operating system describes why the file could
Ora-01110: Data File
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 http://www.dba-oracle.com/t_ora_01157_cannot_identify_lock_data_file_string_see_DBWR_trace_file.htm (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 http://nimishgarg.blogspot.com/2014/01/ora-01157-cannot-identifylock-data-file.html 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 11.2.0.3.0 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