Search This Blog

Tuesday, August 2, 2011

ORA-01122: database file 1 failed verification check

Today one of our test database startup failed with the following error: 

ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF'
ORA-01207: file is more recent than controlfile - old controlfile

Reason: controlfile is older than datafiles.
Solution: re-create controlfile

Action: We need to create controlfile from following statement

SQL>alter database backup controlfile to trace;
after that check UDUMP directory for generated trace file.

NOTE: we can check the udump directory path from parameter
SQL>show parameter user_dump_dest

In th UDUMP folder file name similar like {SID_ORA_FILENO.trc}

In my case: example of trace file and their inside contents

All we need to do is just follow the trace file instruction and we can manage to open database.

Dump file f:\oracle\product\10.1.0\admin\test01\udump\test01_ora_2164.trc
Tue Aug 02 10:54:08 2011
ORACLE V10.1.0.5.0 - Production vsnsta=0
vsnsql=13 vsnxtr=3
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - Production
With the Partitioning, OLAP and Data Mining options
Windows NT Version V5.2 Service Pack 2
CPU                 : 4 - type 586, 2 Physical Cores
Process Affinity    : 0x00000000
Memory (Avail/Total): Ph:903M/2047M, Ph+PgF:884M/3947M, VA:1344M/2047M
Instance name: test01

Redo thread mounted by this instance: 1

Oracle process number: 13

Windows thread id: 2164, image: ORACLE.EXE (SHAD)


*** SERVICE NAME:() 2011-08-02 10:54:08.924
*** SESSION ID:(162.3) 2011-08-02 10:54:08.924
 V10 STYLE FILE HEADER:
Compatibility Vsn = 168822016=0xa100500
Db ID=3559255662=0xd425ee6e, Db Name='TEST01'
Activation ID=0=0x0
Control Seq=2616=0xa38, File size=55040=0xd700
File Number=1, Blksiz=8192, File Type=3 DATA
Tablespace #0 - SYSTEM  rel_fn:1 
Creation   at   scn: 0x0000.00000023 02/03/2006 21:20:36
Backup taken at scn: 0x0000.0030b59d 08/02/2011 10:39:09 thread:1
 reset logs count:0x2ccfafaf scn: 0x0000.0006975e reset logs terminal rcv data:0x0 scn: 0x0000.00000000
 prev reset logs count:0x22a86937 scn: 0x0000.00000001 prev reset logs terminal rcv data:0x0 scn: 0x0000.00000000
 recovered at 07/20/2011 03:30:17
 status:0x2000 root dba:0x00400179 chkpt cnt: 434 ctl cnt:433
begin-hot-backup file size: 55040
Checkpointed at scn:  0x0000.0030b758 08/02/2011 10:50:37
 thread:1 rba:(0x127.455.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
Backup Checkpointed at scn:  0x0000.0030b59d 08/02/2011 10:39:09
 thread:1 rba:(0x125.6e.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
External cache id: 0x0 0x0 0x0 0x0
Absolute fuzzy scn: 0x0000.00000000
Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00
Terminal Recovery Stamp scn: 0x0000.00000000 01/01/1988 00:00:00
Platform Information: Creation Platform ID: 7
Current Platform ID: 7 Last Platform ID: 7
DATA FILE #1: 
  (name #7) F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
 tablespace 0, index=1 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:432 scn: 0x0000.0030b613 08/02/2011 10:43:07
 Stop scn: 0x0000.0030b613 08/02/2011 10:43:07
 Creation Checkpointed at scn:  0x0000.00000023 02/03/2006 21:20:36
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Offline scn: 0x0000.0006975d prev_range: 0
 Online Checkpointed at scn:  0x0000.0006975e 05/22/2011 11:40:31
 thread:1 rba:(0x1.2.0)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED 
Controlfile Sequence# = 2614
*** 2011-08-02 10:54:45.736
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
-- DB_UNIQUE_NAME="test01"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=F:\oracle\product\10.1.0\Db_1\RDBMS'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TEST01" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 454
LOGFILE
  GROUP 1 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO01.LOG'  SIZE 10M,
  GROUP 2 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO02.LOG'  SIZE 10M,
  GROUP 3 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO03.LOG'  SIZE 10M
-- STANDBY LOGFILE
DATAFILE
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\UNDOTBS01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSAUX01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\USERS01.DBF'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'F:\ORACLE\PRODUCT\10.1.0\DB_1\RDBMS\ARC00001_0581462327.001';
-- ALTER DATABASE REGISTER LOGFILE 'F:\ORACLE\PRODUCT\10.1.0\DB_1\RDBMS\ARC00001_0751808431.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\TEMP01.DBF' REUSE;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TEST01" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 454
LOGFILE
  GROUP 1 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO01.LOG'  SIZE 10M,
  GROUP 2 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO02.LOG'  SIZE 10M,
  GROUP 3 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO03.LOG'  SIZE 10M
-- STANDBY LOGFILE
DATAFILE
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\UNDOTBS01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSAUX01.DBF',
  'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\USERS01.DBF'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'F:\ORACLE\PRODUCT\10.1.0\DB_1\RDBMS\ARC00001_0581462327.001';
-- ALTER DATABASE REGISTER LOGFILE 'F:\ORACLE\PRODUCT\10.1.0\DB_1\RDBMS\ARC00001_0751808431.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\TEMP01.DBF' REUSE;
-- End of tempfile additions.
--


Live Example: I use resetlogs case.
SQL> startup
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                   790624 bytes
Variable Size             170127264 bytes
Database Buffers          440401920 bytes
Redo Buffers                1048576 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF'
ORA-01207: file is more recent than controlfile - old controlfile


SQL> alter database backup controlfile to trace;

Database altered.

SQL> --check udump directory for controlfile trace
SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                   790624 bytes
Variable Size             170127264 bytes
Database Buffers          440401920 bytes
Redo Buffers                1048576 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "TEST01" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 454
  7  LOGFILE
  8    GROUP 1 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO01.LOG'  SIZE 10M,
  9    GROUP 2 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO02.LOG'  SIZE 10M,
 10    GROUP 3 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\REDO03.LOG'  SIZE 10M
 11  -- STANDBY LOGFILE
 12  DATAFILE
 13    'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSTEM01.DBF',
 14    'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\UNDOTBS01.DBF',
 15    'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\SYSAUX01.DBF',
 16    'F:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST01\USERS01.DBF'
 17  CHARACTER SET WE8MSWIN1252
 18  ;

Control file created.

SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required


SQL> alter system archive log all;

System altered.

SQL> alter database open;

Database altered.

No comments: