| ![]() | ![]() |
![ORA-1578 <wbr>/ <wbr>ORA-26040 <wbr>Corrupt <wbr>blocks <wbr>by <wbr>NOLOGGING <wbr>- <wbr>Error](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
In this Document
Applies to:Oracle Database - Enterprise Edition - Version 7.1.6.0 to 12.1.0.2 [Release 7.1.6 to 12.1]Information in this document applies to any platform. PurposeThis note is intended to describe how Oracle reports a corruption caused by a NOLOGGING operation and how to fix the errors. ScopeThis document is intended for Customers and Oracle Support. DetailsWhen a segment is defined with the NOLOGGING attribute and if a NOLOGGING/UNRECOVERABLE operation updates
SQL> select * from test_nologging;
ORA-01578: ORACLE data block corrupted (file # 11, block # 84) ORA-01110: data file 4: '/oradata/users.dbf' ORA-26040: Data block was loaded using the NOLOGGING option
RMAN/DBV and Corrupt Blocks by NOLOGGINGDBV prints the generic message DBV-200 in rdbms versions lower than 10.2.0.4 and error DBV-201 in RDBMS versions greater or equal to 10.2.0.4
DBV-00200: Block, dba 46137428, already marked corrupted
DBV-00201: Block, DBA 46137428, marked corrupt for invalid redo application
10.2.0.4 and lower, 11.1.0.6, 11.1.0.7:
RMAN validate reports it in v$database_block_corruption with CORRUPTION_TYPE=LOGICAL In rdbms version 10.2.0.5 or in 11.2.0.1 and forward, RMAN has been enhanced to report it in with CORRUPTION_TYPE=NOLOGGING. Reference Doc ID 7396077.8 :
10.2.0.5 and 11.2.0.1+:
RMAN validate reports it in v$database_block_corruption with CORRUPTION_TYPE=NOLOGGING In rdbms version 12c and forward RMAN validate no longer populates view v$database_block_corruption; instead the new view 12c: RMAN validate reports it in v$nonlogged_block RMAN backups do not fail due to NOLOGGING corrupt blocks. In general RMAN does not fails with soft corrupt blocks so the MAXCORRUPT clause is not necessary in such cases. When there is a generic message besides the error ORA-26040, a block dump might be taken and see if the byte 0xff is along the block or if the block is associated to a segment, try to read it with a SQL statement for which errors ORA-1578/ORA-26040 will be produced as the block is corrupt due to recovery with a NOLOGGING operation. Monitoring NOLOGGING OperationsV$DATAFILE has several columns that are updated when a NOLOGGING operation takes place when parameter db_unrecoverable_scn_tracking is set to true (default value); db_unrecoverable_scn_tracking is not available in 10g.
UNRECOVERABLE_CHANGE#
UNRECOVERABLE_TIME FIRST_NONLOGGED_SCN FIRST_NONLOGGED_TIME Identify when a block was marked as NOLOGGINGTo identify when a block was marked as NOLOGGING, use the block scn in the trace file or use the value in column CORRUPTION_CHANGE# in v$database_block_coruption to translate it to a timestamp: Example from trace file:
Use the value in column CORRUPTION_CHANGE# in v$database_block_coruption If RMAN validate is run the view v$database_block_coruption is populated with corruption_type='NOLOGGING' (10.2.0.5 and 11.2.0.1+) and column CORRUPTION_CHANGE# has the decimal scn value. Get the SCN Timestamp To get the timestamp use any of these methods: select scn_to_timestamp(&&decimal_scn)
In 12c: select file#, block#, scn_to_timestamp(NONLOGGED_START_CHANGE#) If error ORA-08181 is produced query gv$archived_log or gv$log_history to get a time interval approximation: alter session set nls_date_format = 'DD-MON-YY HH24:MI:SS';
alter session set nls_date_format = 'DD-MON-YY HH24:MI:SS'; select file#, block#, first_time, next_time In 12c: alter session set nls_date_format = 'DD-MON-YY HH24:MI:SS'; select file#, block#, first_time, next_time OR select file#, block#, first_time NOARCHIVELOG and NOLOGGING in SYSAUX tablespace / AWR, EM, etc
If the database is running on rdbms versions 11.1.0.6 or 11.1.0.7 or 11.2.0.1, ORA-1578 and ORA-26040 can be produced due to NOLOGGING for DIRECT PATH operations after a manual RECOVER DATABASE in a NOARCHIVELOG mode database even if FORCE LOGGING is enabled in the database or even if LOGGING is defined for the segment. The restriction has been lifted in 11.2.0.2+ and this issue did not occur in 10g. Changes by RDBMS versions
SOLUTION
Is error after RMAN DUPLICATE?If the error is after a RMAN DUPLICATE or RESTORE, enable FORCE LOGGING at SOURCE database and perform the DUPLICATE or RESTORE (after new BACKUP) steps again:
alter database force logging;
Is error produced in a PHYSICAL STANDBY Database?If the error is produced in a PHYSICAL STANDBY database, the option is to restore the affected file from the PRIMARY database (only if the problem is not present in the PRIMARY) and to avoid the problem from being introduced there is the option to force logging in the PRIMARY database with:
alter database force logging;
In order to resolve the errors and if it is not an INDEX the segment can be recovered from a backup like an export dump or from another source. If backups are not available the segment might be recreated following the next steps: Identify the affected segmentIdentify the affected segment Is it a FREE Block?If the NOLOGGING Block is a FREE Block (the associated extent is in dba_free_space), which could be discovered by running DBVerify with error DBV-00201 or shown in view v$database_block_corruption, there is the option to wait until the block is reused which will automatically re-format the block or force re-formatting the block using Doc ID 336133.1 Is it an INDEX?If it is an INDEX, drop and create the index Is it a TABLE?If it is a TABLE, procedure DBMS_REPAIR.SKIP_CORRUPT_BLOCKS can be used to skip the corrupt block in SQL statements; Doc ID 556733.1 has a DBMS_REPAIR example. by moving the table: alter table &table_name move; OR by saving the data (export, Create Table as Select, etc) and then truncate or drop/create. Is it a LOB?If it is a LOB use Doc ID 293515.1 |