วันอาทิตย์ที่ 16 กันยายน พ.ศ. 2555

Keep in mind about Oracle Nologging Option

Many Time, We using Oracle "Nologging" Option to avoid the redo generate and speed up of bulk load, CTAS and etc, This is pros of nologging, but in cons that come from you can't recover the objects that using "Nologging" in some case, The below demonstrate will let you see my explanation on above:

*****You must have backupset for database before follow below step *****

1. Prepare 
create table t nologging as select * from all_objects;

2. Query Test
select count(*) from t;

3. Flush Buffer Cache
alter system flush buffer_cache;

4. Check block
select min(dbms_rowid.rowid_relative_fno(rowid)) "File_Number",
       min(dbms_rowid.rowid_block_number(rowid)) "Block number"
from t;

5. Corrupt Data Block
dd of=$FILE bs=$BLOCKNO conv=notrunc seek=8196
dd of=$FILE bs=$BLOCKNO conv=notrunc seek=`expr 1 + 8196`

6. Query Test, You will see the error
select count(*) from t;

7. Restore + Recover
rman target /
sql 'alter database datafile 11 offline';
restore datafile 11;
recover datafile 11;
sql 'alter database datafile 11 online';

8. Query Test you will found nologging problem your object can't recover
select count(*) from t;

If you following step by step until step 8 you will see

ORA-26040: Data block was loaded using the NOLOGGING option

Cause: Trying to access data in block that was loaded without redo generation using the NOLOGGING/UNRECOVERABLE option
Action: Drop the object containing the block.


Very carefully when using this option, it can make your object to be unrecoverable state.


Hope this help you to more understand :D
Chatchai Komrangded

ไม่มีความคิดเห็น:

แสดงความคิดเห็น