Search This Blog

Wednesday, January 18, 2012

Oracle Fuzzy Bits.

If there are FUZZY BITS in the datafile header then that means there
may have been writes on the datafile after the last checkpoint.

So, whenever a datafile is opened it is checked for fuzzy bits.
If it is fuzzy then the database checks the checkpoint_change$
column to search the SCN from which the redo logs are to be applied.

ILLUSTRATION:

The following query shows the status and checkpoint information
of my datafiles.

SQL> select file#,status,checkpoint_count,checkpoint_change# 
 from v$datafile_header;

     FILE# STATUS  CHECKPOINT_COUNT CHECKPOINT_CHANGE#
---------- ------- ---------------- ------------------
         1 ONLINE               102             814577
         2 ONLINE               102             814577
         3 ONLINE                30             814577
         4 ONLINE               101             814577
         5 ONLINE                26             814577





SQL> select file_name from dba_data_files;

FILE_NAME
-----------------------------------------
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf

Now i will take my EXAMPLE tablespace datafile offline.

SQL> alter database datafile '/u01/app/oracle/oradata/
orcl/example01.dbf' offline;

Database altered.

SQL> select file#,status,checkpoint_count,checkpoint_change#
 from v$datafile_header;

     FILE# STATUS  CHECKPOINT_COUNT CHECKPOINT_CHANGE#
---------- ------- ---------------- ------------------
         1 ONLINE               103             818410
         2 ONLINE               103             818410
         3 ONLINE                31             818410
         4 ONLINE               102             818410
         5 OFFLINE               27             818410

Now i will do a checkpoint.

SQL> alter system checkpoint;

System altered.

SQL> select file#,status,checkpoint_count,checkpoint_change#
 from v$datafile_header;

     FILE# STATUS  CHECKPOINT_COUNT CHECKPOINT_CHANGE#
---------- ------- ---------------- ------------------
         1 ONLINE               104             818477
         2 ONLINE               104             818477
         3 ONLINE                32             818477
         4 ONLINE               103             818477
         5 OFFLINE               27             818410

Now after checkpoint the checkpoint count on all the database
has increased except for the EXAMPLE TABLESPACE DATAFILE, if
i try to bring my datafile online now it will require
datafile recovery. Beacuse it has a fuzzy bit on it.

SQL> alter database datafile '/u01/app/oracle/oradata
/orcl/example01.dbf' online;

alter database datafile '/u01/app/oracle/oradata
/orcl/example01.dbf' online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/u01/app/oracle/oradata
/orcl/example01.dbf'


SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile '/u01/app/oracle/oradata
/orcl/example01.dbf' online;

Database altered.

SQL> select file#,status,checkpoint_count,checkpoint_change#
 from v$datafile_header;

     FILE# STATUS  CHECKPOINT_COUNT CHECKPOINT_CHANGE#
---------- ------- ---------------- ------------------
         1 ONLINE               104             818477
         2 ONLINE               104             818477
         3 ONLINE                32             818477
         4 ONLINE               103             818477
         5 ONLINE                29             818559


0 comments:

Post a Comment