ORA-1578 / ORA-26040&n…
来源:互联网 发布:广州数据修复中心 编辑:程序博客网 时间:2024/06/05 05:34
When a segment is defined with the NOLOGGING attribute - OR - if aNOLOGGING/UNRECOVERABLE operation updates the segment, the onlineredo log file is updated with minimal information to invalidate theaffected blocks when a RECOVERY is later performed.
If the associated redo/archived log file is used to RECOVER thedata files, Oracle invalidates such blocks and the error ORA-26040along with error ORA-1578 are reported by SQL statements in thenext block reads.
The data inside the affected blocks is not salvageable. Methodslike "Media Recovery" or "RMAN blockrecover" will not fix theproblem unless the data file was backed up after the NOLOGGINGoperation was registered in the Redo Log.
In order to resolve the errors and if it is not an INDEX thesegment can be recovered from a backup like an export dump or fromanother source. If backups are not available the segment might berecreated following the next steps:
Identify the object.
If it is an INDEX, drop/create the index.
If it is a TABLE and you may select full contents w/out any erroryou may either shrink it's size or move to relocate within sametablespace or even rename the bad_table and create table as selectto build a new one.
If it is a TABLE which reports error then procedureDBMS_REPAIR.SKIP_CORRUPT_BLOCKS can be used to skip the corruptblock in SQL statements and decide to re-create the table.Note 556733.1 has an example ofDBMS_REPAIR.
If it is a LOB segment associated to a LOB column in a Table, useNote 293515.1
If the error is produced in a Physical STANDBY database, the optionis to restore the affected file from the PRIMARY database (only ifthe problem is not present in the PRIMARY).
. How to Avoid:
---------------
.- Ensuring backup of affected datafiles after each NOLOGGEDoperations is performed to avoid having them recovered
.- Check V$Datafile for UNRECOVERABLE_CHANGE# /UNRECOVERABLE_TIME
.- Setting Database into FORCE LOGGING mode (which is true for SYSobjects)
转到底部
In thisDocument
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.
Purpose
This note is intended to describe how Oracle reports acorruption caused by a NOLOGGING operation and how to fix theerrors.
Scope
This document is intended for Customers and Oracle Support.
Details
When a segment is defined with the NOLOGGING attribute and if aNOLOGGING/UNRECOVERABLE operation updates
If the associated redo/archived log file is used to RECOVER thedata files, Oracle invalidates such blocks and the error ORA-26040along with error ORA-1578 are reported by SQL statements in thenext block reads.
Errors Example:
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
The NOLOGGING attribute is stored in column LOGGING in datadictionary views like:
DBA_TABLES, DBA_INDEXES, DBA_LOBS, DBA_TAB_PARTITIONS,DBA_LOB_PARTITIONS, DBA_TAB_SUBPARTITIONS, etc.
LOGGING='NO' indicates NOLOGGING.
The block is then marked as Soft Corrupt meaning that the nextblock read will report the ORA-1578/ORA-26040 errors.
RMAN/DBV and Corrupt Blocks by NOLOGGING
DBV prints the generic message DBV-200 in rdbms versions lowerthan 10.2.0.4 and error DBV-201 in RDBMS versions greater or equalto 10.2.0.4
DBV-00201: Block, DBA 46137428, marked corrupt for invalid redoapplication
In rdbms versions lower than 10.2.0.5 and11.1.0.7,
RMAN validate reports it inv$database_block_corruption withCORRUPTION_TYPE=LOGICAL
In rdbms version 10.2.0.5 or in 11.2.0.1 and forward, RMAN hasbeen enhanced to report it in with CORRUPTION_TYPE=NOLOGGING.Reference Doc ID 7396077.8 :
RMAN validate reports it in v$database_block_corruptionwith CORRUPTION_TYPE=NOLOGGING
In rdbms version 12c and forward RMAN validate no longerpopulates view v$database_block_corruption; instead the newview
12c:
RMAN validate reports it in v$nonlogged_block
RMAN backups do not fail due to NOLOGGING corrupt blocks. Ingeneral RMAN does not fails with soft corrupt blocks so theMAXCORRUPT clause is not necessary in such cases.
When there is a generic message besides the error ORA-26040, ablock dump might be taken and see if the byte 0xff is along theblock or if the block is associated to a segment, try to read itwith a SQL statement for which errors ORA-1578/ORA-26040 will beproduced as the block is corrupt due to recovery with a NOLOGGINGoperation.
Monitoring NOLOGGING Operations
V$DATAFILE has several columns that are updated when a NOLOGGINGoperation takes place when parameter db_unrecoverable_scn_tracking is set to true (default value);db_unrecoverable_scn_tracking is not available in10g.
UNRECOVERABLE_TIME
FIRST_NONLOGGED_SCN
FIRST_NONLOGGED_TIME
Identify when a block was marked asNOLOGGING
To identify when a block was marked as NOLOGGING, use the blockscn in the trace file or use the value in column CORRUPTION_CHANGE#in v$database_block_coruption to translate it to a timestamp:
Use the block scn from atrace file
Example from trace file:
Take 0x0771.4fa24eb5, remove the '.' and convert 0x07714fa24eb todecimal which is 511453045995
Use the value in columnCORRUPTION_CHANGE# in v$database_block_coruption
If RMAN validate is run the view v$database_block_coruption ispopulated with corruption_type='NOLOGGING' (10.2.0.5 and 11.2.0.1+)and column CORRUPTION_CHANGE# has the decimal scn value.
Get the SCNTimestamp
To get the timestamp use any of these methods:
selectscn_to_timestamp(&&decimal_scn)
from dual;
If RMAN validate was run:
select file#, block#, scn_to_timestamp(CORRUPTION_CHANGE#)
from v$database_block_corruption
where CORRUPTION_TYPE='NOLOGGING';
In 12c:
select file#, block#,scn_to_timestamp(NONLOGGED_START_CHANGE#)
from v$nonlogged_block;
If error ORA-08181 is produced query gv$archived_log orgv$log_history to get a time interval approximation:
alter session set nls_date_format ='DD-MON-YY HH24:MI:SS';
select first_time, next_time
from
where
OR
select first_time
from
where
if RMAN validate was run:
alter session set nls_date_format ='DD-MON-YY HH24:MI:SS';
select file#, block#, first_time,next_time
from
where
OR
select file#, block#, first_time
from
where
In 12c:
alter session set nls_date_format ='DD-MON-YY HH24:MI:SS';
select file#, block#, first_time,next_time
from v$nonlogged_block, v$archived_log
where NONLOGGED_START_CHANGE# between first_change# andnext_change#;
OR
select file#, block#, first_time
from v$nonlogged_block, v$log_history
where NONLOGGED_START_CHANGE# between first_change# andnext_change#;
NOARCHIVELOG and NOLOGGING in SYSAUX tablespace / AWR,EM, etc
If the database is running on rdbms versions 11.1.0.6 or11.1.0.7 or 11.2.0.1, ORA-1578 and ORA-26040 can be produced due toNOLOGGING for DIRECT PATH operations after a manual RECOVERDATABASE in a NOARCHIVELOG mode database even if FORCE LOGGING isenabled in the database or even if LOGGING is defined for thesegment.
This is most commonly seen in AWR or EM objects (EnterpriseManager) stored in the SYSAUX tablespace.
Reference Doc Id 1071869.1 for details and solution.
The restriction has been lifted in 11.2.0.2+ and this issue didnot occur in 10g.
Changes by RDBMS versions
SOLUTION
Note that the data inside the affected blocks is not salvageable.Methods like "Media Recovery" or "RMAN blockrecover" will not fixthe problem unless the data file was backed up after the NOLOGGINGoperation was registered in the Redo Log.
Is error after RMAN DUPLICATE?
If the error is after a RMANDUPLICATE or RESTORE, enable FORCE LOGGING at SOURCEdatabase and perform the DUPLICATE or RESTORE (after new BACKUP)steps again:
Is error produced in a PHYSICAL STANDBY Database?
If the error is produced in aPHYSICAL STANDBY database, the option is torestore the affected file from the PRIMARY database (only if theproblem is not present in the PRIMARY) and to avoid the problemfrom being introduced there is the option to force logging in thePRIMARY database with:
In order to resolve the errors and if it is not an INDEX thesegment can be recovered from a backup like an export dump or fromanother source. If backups are not available the segment might berecreated following the next steps:
Identify the affected segment
Identify the affectedsegment
Is it a FREE Block?
If the NOLOGGING Block is aFREE Block (the associated extent is indba_free_space), which could be discovered by running DBVerify witherror DBV-00201 or shown in view v$database_block_corruption, thereis the option to wait until the block is reused which willautomatically re-format the block or force re-formatting the blockusing 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 thecorrupt 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, CreateTable as Select, etc) and then truncate or drop/create.
Is it a LOB?
If it is a LOB useDoc ID 293515.1
- ORA-1578 / ORA-26040&n…
- ORA-01659: unable to&n…
- ORA-16179: incremental&nbsp…
- Troubleshooting ORA-1555&nb…
- "ORA-01086: savepoint&…
- ORA-00845: MEMORY_TARGET&nb…
- impdp报ora-39001 ora-39000&…
- ORA-1652: Unable To&nb…
- ORA-4031 and Shared&nb…
- ORA-31626: job does&nb…
- ORA-01207: file is&nbs…
- ORA-00445: 后台进程 &q…
- ORA-00314: LOG 404&nbs…
- 由于 ORA-20100: 错误:&…
- ORA-22992: cannot use&…
- ORA-28056:Writing audit&nb…
- ORA-12514: TNS:listener&nbs…
- ORA-16014,接着 …
- ORACLE RAC环境下读取序列乱序问题
- How to Move Table…
- 链接服务器使用OPENQUERY性能提升
- High "Library Cache&nb…
- Table '%s' i…
- ORA-1578 / ORA-26040&n…
- 100
- Solaris 查找一个目录下软链…
- Solaris 10 安装 VNC
- Lag和Lead函数
- Ubuntu 16.04 编译 opencv-3.2.0 + opencv_contrib-3.2.0
- 规范模式-------From ABP Document
- 密码延迟验证导致的系统HANG住
- Incomplete recovery gi…