Monday, March 10, 2014

ORA-01157 cannot identifylock data file 6 - see DBWR trace file

Cause:- This error occurred when data file are not present In data file directory. You can solve this problem in the following way ...

 1. If data in this file is not important that remove this file information from database then open your database.
2. If data in this file is important and  backup are available for this file and if your database is in archive log mode than you can recover the data in this file. (http://rajiboracle.blogspot.com/2014/09/ora-01157-cannot-identifylock-data-file.html)

Solution using 1.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: 'D:\ORACLE\TBACNTS.DBF'


SQL> select b.name as TABLESPACE_NAME ,status from v$datafile a ,v$tablespace b where a.ts#=b.ts#;

TABLESPACE_NAME                STATUS
------------------------------ -------
SYSTEM                         SYSTEM
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
USERS                          ONLINE
EXAMPLE                        ONLINE
TBACNTS                        ONLINE
TRBFES                         ONLINE
TBFES                          ONLINE
TBAML                          ONLINE
DATA                           ONLINE
TBSTRAN                        ONLINE

11 rows selected.

SQL>
SQL>
SQL> alter database datafile 'D:\ORACLE\TBACNTS.DBF' offline drop;

Database altered.

SQL> drop tablespace TRBFES including contents and datafiles;
drop tablespace TRBFES including contents and datafiles
*
ERROR at line 1:
ORA-01109: database not open


SQL> alter database datafile 'D:\ORACLE\TRBFES.DBF' offline drop;

Database altered.

SQL> alter database datafile 'D:\ORACLE\TBFES.DBF' offline drop;

Database altered.

SQL>
SQL>
SQL> alter database datafile 'D:\ORACLE\TBAML.DBF' offline drop;

Database altered.

SQL>
SQL> alter database datafile 'D:\ORACLE\DATA.DBF' offline drop;

Database altered.

SQL>
SQL> alter database datafile 'D:\ORACLE\TBstran.DBF' offline drop;
alter database datafile 'D:\ORACLE\TBstran.DBF' offline drop
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file
"D:\ORACLE\TBstran.DBF"


SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 11 - see DBWR trace file
ORA-01110: data file 11: 'D:\ORACLE\TBSTRAN .DBF'


SQL>
SQL> alter database datafile 'D:\ORACLE\TBSTRAN .DBF' offline drop;

Database altered.

SQL> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL>

No comments:

Post a Comment