Tuesday, August 9, 2016

ORA-01157

ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 1: '/PRIM/u02/oradata/orcl/users01.dbf'

SQL> startup
ORACLE instance started.
Total System Global Area 1286066176 bytes
Fixed Size                                2287960 bytes
Variable Size                        452986536 bytes
Database Buffers               822083584 bytes
Redo Buffers                         8708096 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 1: '/PRIM/u02/oradata/orcl/users01.dbf'

SQL> col error format a15
SQL> select * from v$recover_file;

     FILE# ONLINE  ONLINE_ ERROR                   CHANGE# TIME              CON_ID
    --------- -----------  ------------------------                  -----------------------             -----------
         6      ONLINE  ONLINE  FILE NOT FOUND          0                                    0

SQL> col file_name format a40
SQL> col tablespace_name format a15
SQL> select a.file#,a.name as FILE_NAME,b.name as TABLESPACE_NAME,status from v$datafile a,v$tablespace b where a.ts#=b.ts#;

     FILE# FILE_NAME                                                            TABLESPACE_NAME STATUS
    -------- -----------------------------------------                            ----------------------------- -----------
        1      /PRIM/u02/oradata/orcl/system01.dbf                             SYSTEM                SYSTEM
        3      /PRIM/u02/oradata/orcl/sysaux01.dbf                             SYSAUX                ONLINE
        4      /PRIM/u02/oradata/orcl/undotbs01.dbf                           UNDOTBS1           ONLINE
        6      /PRIM/u02/oradata/orcl/users01.dbf                                USERS                   ONLINE
        2      /PRIM/u02/oradata/orcl/example01.dbf                           EXAMPLE            ONLINE

SQL> alter database datafile '/PRIM/u02/oradata/orcl/users01.dbf' offline;
Database altered.
SQL> alter database open;
Database altered.
SQL> col file_name format a40
SQL> col tablespace_name format a15
SQL> select a.file#,a.name as FILE_NAME,b.name as TABLESPACE_NAME,status from v$datafile a,v$tablespace b where a.ts#=b.ts#;

     FILE# FILE_NAME                                             TABLESPACE_NAME STATUS
    -------- ----------------------------------------              ----------------------------- -----------
        1      /PRIM/u02/oradata/orcl/system01.dbf              SYSTEM               SYSTEM
        2      /PRIM/u02/oradata/orcl/example01.dbf           EXAMPLE            ONLINE
        3      /PRIM/u02/oradata/orcl/sysaux01.dbf              SYSAUX               ONLINE
        4      /PRIM/u02/oradata/orcl/undotbs01.dbf            UNDOTBS1          ONLINE
        6      /PRIM/u02/oradata/orcl/users01.dbf                 USERS                  OFFLINE
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oraprim@localhost ~]$ rman target / catalog rman/rman@oracat

Recovery Manager: Release 12.1.0.1.0 - Production on Tue Mar 22 12:35:52 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1434527233)
connected to recovery catalog database

RMAN>list backup of datafile 6;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
178     Full    1.26G      DISK        00:03:06     19-MAR-16     
        BP Key: 184   Status: AVAILABLE  Compressed: NO  Tag: TAG20160319T140522
        Piece Name: /RMAN_Backup/Backup_ORCL_09r0shh5_1_1_20160319_1
  List of Datafiles in backup set 178
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 1791582    19-MAR-16 /PRIM/u02/oradata/orcl/users01.dbf
RMAN> restore datafile 6 preview;

Starting restore at 22-MAR-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=48 device type=DISK


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
178     Full    1.26G      DISK        00:03:06     19-MAR-16     
        BP Key: 184   Status: AVAILABLE  Compressed: NO  Tag: TAG20160319T140522
        Piece Name: /RMAN_Backup/Backup_ORCL_09r0shh5_1_1_20160319_1
  List of Datafiles in backup set 178
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 1791582    19-MAR-16 /PRIM/u02/oradata/orcl/users01.dbf
using channel ORA_DISK_1

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
281     1    12      A 19-MAR-16
        Name: /PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_12_1_906746499.arc

279     1    13      A 19-MAR-16
        Name: /PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_13_1_906746499.arc

Media recovery start SCN is 1791582
Recovery must be done beyond SCN 1791582 to clear datafile fuzziness
Finished restore at 22-MAR-16

RMAN> restore datafile 6;

Starting restore at 22-MAR-16
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00006 to /PRIM/u02/oradata/orcl/users01.dbf
channel ORA_DISK_1: reading from backup piece /RMAN_Backup/Backup_ORCL_09r0shh5_1_1_20160319_1
channel ORA_DISK_1: piece handle=/RMAN_Backup/Backup_ORCL_09r0shh5_1_1_20160319_1 tag=TAG20160319T140522
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 22-MAR-16
RMAN> recover datafile 6;

Starting recover at 22-MAR-16
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 12 is already on disk as file /PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_12_1_906746499.arc
archived log for thread 1 with sequence 13 is already on disk as file /PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_13_1_906746499.arc
archived log file name=/PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_12_1_906746499.arc thread=1 sequence=12
archived log file name=/PRIM/u02/app/oraprim/product/12.1.0/dbhome_1/database/archive/Log_55812601_13_1_906746499.arc thread=1 sequence=13
media recovery complete, elapsed time: 00:00:00
Finished recover at 22-MAR-16

RMAN> exit
Recovery Manager complete.

[oraprim@localhost ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 12.1.0.1.0 Production on Tue Mar 22 12:40:13 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select name, open_mode from v$database;
NAME     OPEN_MODE
--------- --------------------
ORCL       READ WRITE
SQL> col file_name format a40
SQL> col tablespace_name format a15
SQL> select a.file#,a.name as FILE_NAME,b.name as TABLESPACE_NAME,status from v$datafile a,v$tablespace b where a.ts#=b.ts#;

     FILE# FILE_NAME                                                            TABLESPACE_NAME STATUS
    --------- -----------------------------------------                           ----------------------------- -----------
         1       /PRIM/u02/oradata/orcl/system01.dbf                            SYSTEM               SYSTEM
         2       /PRIM/u02/oradata/orcl/example01.dbf                         EXAMPLE            ONLINE
         3       /PRIM/u02/oradata/orcl/sysaux01.dbf                            SYSAUX               ONLINE
         4       /PRIM/u02/oradata/orcl/undotbs01.dbf                          UNDOTBS1          ONLINE
         6       /PRIM/u02/oradata/orcl/users01.dbf                               USERS                  OFFLINE

SQL> alter database datafile '/PRIM/u02/oradata/orcl/users01.dbf' online;
Database altered.
SQL> col file_name format a40
SQL> col tablespace_name format a15
SQL> select a.file#,a.name as FILE_NAME,b.name as TABLESPACE_NAME,status from v$datafile a,v$tablespace b where a.ts#=b.ts#;

      FILE# FILE_NAME                                                            TABLESPACE_NAME STATUS
    --------- -----------------------------------------                           ----------------------------- -----------
         1       /PRIM/u02/oradata/orcl/system01.dbf                            SYSTEM               SYSTEM
         2       /PRIM/u02/oradata/orcl/example01.dbf                         EXAMPLE            ONLINE
         3       /PRIM/u02/oradata/orcl/sysaux01.dbf                            SYSAUX               ONLINE
         4       /PRIM/u02/oradata/orcl/undotbs01.dbf                          UNDOTBS1          ONLINE
         6       /PRIM/u02/oradata/orcl/users01.dbf                               USERS                  ONLINE  

No comments:

Post a Comment

IAS Cache initialization failed

 Today I faced an Issue in R12.2 instance. The solution I followed to overcome the issue is very simple, but they are more than one solution...