Adsense

Tuesday, 3 March 2015

ORA-01157 and ORA-01110 while trying to bring the tablespace online

ORA-01157 and ORA-01110 while trying to bring the tablespace online




Issue:


SQL> alter tablespace 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\.........\ORADATA\ORCL\EXAMPLE01.DBF'



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.


Have operating system make file available to database. Then either open the database or do ALTER SYSTEM CHECK DATAFILES.


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 unable to reach a data file, or is unable to lock it because it is in use , ORA-01157 is thrown because the database does not allow access. The other files will not be affected, but it is important to know that opening the database using the first instance will need to use online data files. there should be other errors which appear along with ORA-01157 to aid in resolving the problem.


Straightening out ORA-01157 consists of making the files of the database available, and either regularly opening the database, or use ALTER SYSTEM CHECK DATAFILES.




Solution:
Change the access permissions to file. Example, chmod 777 file_name.




No comments:

Post a Comment