How to Format Corrupted Block Not Part of Any Segment (Doc ID 336133.1)    To BottomTo Bottom    

In this Document
Symptoms
Changes
Cause
Solution
References APPLIES TO:
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
SYMPTOMS
. Rman backup fails with ORA- error and the block reported corrupt does not belong to any object
. Dbverify shows the block as corrupted
. Corrupted block does not belong to any object CHANGES CAUSE
Corrupted block will still be reported by RMAN and DBV until it is reused and reformatted. SOLUTION
DISCLAIMER :-The steps given in this note are not always guaranteed to work A possible way to fix the problem is provided below. Note that it is not guaranteed to work, but it has been known to resolve the problem in several cases.Also if there are many blocks reported corrupt in a particular datafile pass the highest block number reported corrupt for that datafile, when prompted for blocknumber in Step When an object is recreated the blocks allocated (even corrupted block) to it are returned to free space. There they await reallocation to an object requiring additional space. Once they are reallocated to a new extent for an object and only when any DML operation makes use of these block (Even Corrupted blocks which were in free space and now allocated) they would be reformatted just before the DML operation makes modifcation/use of those blocks. Note that a simple allocation of extent does not format the block. Step allocates the extent and step performs DML operation to make use of allocated block in step so that corrupt block gets reused and formatted. In this note we try to reformat the block manually. Step - Identify corrupt datafile The corruption may be reported at the application level, such as DBV and RMAN, or the alert.log. For example, you may receive the following during your RMAN backups: RMAN-: failure of backup command on <channel_name> channel at // :: ORA-: exceeded limit of corrupt blocks for file E:\xxxx\<datafilename>.ORA. Corrupt block is present in file E:\xxxx\<datafilename>.ORA. Step Run DBV/Rman validate on affected datafile and check for corrupt block Run dbverify on the datafile which reports corrupt block. # dbv userid={system/<password>} file={full path filename} logfile={output filename}
Check the {output filename} for the result Sample Output: DBVERIFY: Release 9.2.0.3. - Production on Thu Aug ::
Copyright (c) , , Oracle Corporation. All rights reserved. DBVERIFY - Verification starting : FILE = E:\xxxx\<datafilename>.ORA Page is marked corrupt *** Corrupt block relative dba: 0x01c0be64 (file , block )
Bad check value found during dbv: Data in bad block - type: format: rdba: 0x0000be64
last change scn: 0x0000. seq: 0x1 flg: 0x05
consistency value in tail: 0x00000001
check value in block header: 0xb964, computed block checksum: 0x2a5a
spare1: 0x0, spare2: 0x0, spare3: 0x0
*** DBVERIFY - Verification complete Total Pages Examined :
Total Pages Processed (Data) :
Total Pages Failing (Data) :
Total Pages Processed (Index):
Total Pages Failing (Index):
Total Pages Processed (Other):
Total Pages Processed (Seg) :
Total Pages Failing (Seg) :
Total Pages Empty :
Total Pages Marked Corrupt :
Note that Block is reported as corrupt in datafile . Or in RMAN: For Entire database Rman> backup validate check logical database ; For specific datafile Rman> backup validate check logical datafile <fileno> ; Once done query SQL>Select * from v$database_block_corruption ; **If large number of blocks are reported, proceed to step instead of step . Step - Check whether block is part of any object - For Small Number of Corrupted Blocks Query dba_extents and cross check the block does not belong to any object : SQL> select segment_name, segment_type, owner
from dba_extents
where file_id = <Absolute file number>
and <corrupted block number> between block_id
and block_id + blocks -; If it doesn't belong to an object, double check if it does exists in dba_free_space : SQL> Select * from dba_free_space where file_id= <Absolute file number>
and <corrupted block number> between block_id and block_id + blocks -; If the block cannot be found on DBA_FREE_SPACE nor DBA_EXTENTS, the block might be a file space usage bitmap and cannot be reformatted. Step - Check whether block is part of any object - For Large Number of Corrupted Blocks If you have already ran rman validate in step go to directly sqlplus script given below to identify the object $ rman target / nocatalog
or
$ rman target sys/ nocatalog run {
allocate channel d1 type disk;
allocate channel d2 type disk;
------------------------------------------------------------------------
-- multiple channels may be allocated for parallelizing purposes
-- depends: RMAN - Min ( MAXOPENFILES , FILESPERSET )
-- Defaults: MAXOPENFILES =, FILESPERSET =
------------------------------------------------------------------------
allocate channel dn type disk;
backup check logical validate database;
} Note: if RDBMS is < 11g and NOARCHIVELOG mode, then db must be in MOUNTED mode *** The RMAN check logical validate database command MUST be executed and completed before going any further.
*** The 'v$database_block_corruption' view gets populated upon this command completion.
*** If not complete, you risk to get invalid/incomplete information from the below step. Run the following sql query to find if the block is in free space or occupied set lines pages
col segment_name format a30 SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file#
, greatest(e.block_id, c.block#) corr_start_block#
, least(e.block_id+e.blocks-, c.block#+c.blocks-) corr_end_block#
, least(e.block_id+e.blocks-, c.block#+c.blocks-)
- greatest(e.block_id, c.block#) + blocks_corrupted
, null description
FROM dba_extents e, v$database_block_corruption c
WHERE e.file_id = c.file#
AND e.block_id <= c.block# + c.blocks -
AND e.block_id + e.blocks - >= c.block#
UNION
SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file#
, header_block corr_start_block#
, header_block corr_end_block#
, blocks_corrupted
, 'Segment Header' description
FROM dba_segments s, v$database_block_corruption c
WHERE s.header_file = c.file#
AND s.header_block between c.block# and c.block# + c.blocks -
UNION
SELECT null owner, null segment_type, null segment_name, null partition_name, c.file#
, greatest(f.block_id, c.block#) corr_start_block#
, least(f.block_id+f.blocks-, c.block#+c.blocks-) corr_end_block#
, least(f.block_id+f.blocks-, c.block#+c.blocks-)
- greatest(f.block_id, c.block#) + blocks_corrupted
, 'Free Block' description
FROM dba_free_space f, v$database_block_corruption c
WHERE f.file_id = c.file#
AND f.block_id <= c.block# + c.blocks -
AND f.block_id + f.blocks - >= c.block#
ORDER BY file#, corr_start_block#; Step - Create a dummy table as user other than SYS and SYSTEM SQL> connect <username>/<password> Create a dummy table in the tablespace containing datafile which has the corrupt block - and use nologging option to prevent redo records from being generated: SQL> create table s (
n number,
c varchar2()
) nologging tablespace <tablespace name having the corrupt block> pctfree ; Different storage parameters can be used to suit the specific environment. We use the PCTFREE to speed up the reformat of the block Verify that the table is created in the correct tablespace by querying user_segments: SQL> select segment_name,tablespace_name from user_segments
where segment_name='S' ; Please note in 11gr2 due to deferred segment creation concept query from above user_segments may not report any rows in such cases query user_tables SQL>Select table_name,tablespace_name from user_tables where table_name='S' ; Step - Create trigger on dummy table which throws exception once the corrupted block is reused Login as SYSDBA Please note when prompted for file number enter the relative file no(rfile# value from v$datafile) CREATE OR REPLACE TRIGGER corrupt_trigger
AFTER INSERT ON <username>.s
REFERENCING OLD AS p_old NEW AS new_p
FOR EACH ROW
DECLARE
corrupt EXCEPTION;
BEGIN
IF (dbms_rowid.rowid_block_number(:new_p.rowid)=&blocknumber)
and (dbms_rowid.rowid_relative_fno(:new_p.rowid)=&filenumber) THEN
RAISE corrupt;
END IF;
EXCEPTION
WHEN corrupt THEN
RAISE_APPLICATION_ERROR(-, 'Corrupt block has been formatted');
END;
/ When prompted for the block number, provide the block reported corrupt as input.
When prompted for the file number enter the relative fileno (rfile# value from v$datafile) for corrupt datafile. Step - Allocate space to the table from the affected datafile Notes
) If this is an ASSM tablespace, you may need to repeat this step a few times. That is, create multiple tables and allocate multiple extents.
And periodically look at dba_extents to ensure that the free space is now allocated to a dummy table. This is because ASSM will automatically determine the size of the next extent
) It is advisable to ensure that AUTOEXTEND is OFF for the datafile, to prevent it from growing Please note :- If your database is on 10.2.0.4/11.1.0.7 and tablespace in which dummy table is created is ASSM then you might hit the below bug while manually Allocating extent to the dummy table. Ensure for 10.2.0.4/11.1.0.7 database you have the below fix installed before Manually allocating extents.Ensure you have One off patch applied for 10.2.0.4/11.1.0.7 database version. Bug - Corruption / OERI [kddummy_blkchk] .. [] with ASSM (Doc ID 6647480.8) Firstly, find the extent size by querying dba_free_space SQL> Select BYTES from dba_free_space where file_id=<file no> and <corrupt block no> between block_id and block_id + blocks -; BYTES
---------------- ---------- ---------- ---------- ---------- ------------ In this case it's 64K, so allocate the extent as follows: SQL> alter table <username>.s
allocate extent (DATAFILE 'E:\xxxx\<datafilename>.ORA' SIZE 64K); If there are multiple extents of 64K free in this datafile, you may need use this loop: BEGIN
for i in .. loop
EXECUTE IMMEDIATE 'alter table <username>.s allocate extent (DATAFILE '||'''E:\xxxx\<datafilename>.ORA''' ||'SIZE 64K) ';
end loop;
end ;
/ Keep allocating until the corrupted block is part of <username>.s. Use this query to confirm thus: SQL> select segment_name, segment_type, owner
from dba_extents
where file_id = <Absolute file number>
and <corrupt block number> between block_id
and block_id + blocks - ; Step - Insert data into dummy table to format the block Sample code (depending on the size of the tablespace it may vary): BEGIN
FOR i IN .. LOOP
INSERT /*+ APPEND */ INTO <username>.s select i, lpad('REFORMAT',, 'R') from dual;
commit ;
END LOOP;
END; Or BEGIN
FOR i IN .. LOOP
INSERT INTO <username>.s VALUES(i,'x');
END LOOP;
END;
/
Or use the below code which includes loops: Begin
FOR i IN .. loop
for j IN .. loop
Insert into <username>.s VALUES(i,'x');
end loop;
commit;
END LOOP;
END; The trigger will be fired for every row inserted into the table and an exception with ORA- will be produced as soon as it inserts the first row into the corrupt block. Step - Confirm that the block is now corruption free Run dbverify or RMAN validate on the corrupt datafile (or entire database) again. It will not show the block as corrupted. Ensure you do couple of manual logswitch or checkpoint for information in memory to be written to disk. RMAN backup will not report any error on this block. Before running the actual backup you can re-run Rman validate command on the datafile and check v$database_block_corruption doesnot show the block formatted as corrupted. For Db version <=10gr2 Rman> Backup validate check logical datafile <fileno>,<fileno> ; For Db version >= 11gr1 Rman> Backup validate check logical datafile <fileno> ; Or Rman> validate datafile <fileno> block <blockno reported corrupt>, <blockno reported corrupt> ; Once done SQL>Select * from v$database_block_corruption ; Step - Drop the dummy table created in step SQL> DROP TABLE <username>.s ; If 10gr1 and above drop table with purge option. Step :- Do a Manual logswitch and checkpoint Do couple of logswitch and checkpoint so that The block formatted in-memory are written into disk and dbverify no longer reports errors SQL>Alter system switch logfile ; --> Do this couple of time SQL>Alter system checkpoint ; Step :- Drop trigger created in step SQL> DROP trigger corrupt_trigger ; Important: Bug - ORA- Free corrupt blocks may not be reformatted when Flashback is enabled

ORA-19566: exceeded limit of 0 corrupt blocks for file E:\xxxx\<datafilename>.ORA.的更多相关文章

  1. Fix Corrupt Blocks on HDFS

    来自:http://centoshowtos.org/hadoop/fix-corrupt-blocks-on-hdfs/ How do I know if my hadoop hdfs filesy ...

  2. 批量上传文件或者上传大文件时 gateWay报错DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144

    一.描述 最近在批量上传文件时网关出现了异常,后面发现上传大文件也会出现文件超过256发生异常,异常信息如下: org.springframework.core.io.buffer.DataBuffe ...

  3. rac的一次问题 ORA-01565: error in identifying file '+DATA/bol/spfilebol.ora'

    昨天安装的测试环境的rac--2节点 CentOS release 6.8 (Final) SQL*Plus: Release 11.2.0.4.0 Production 今天测试突然出现问题 在ra ...

  4. peomethues 参数设置 监控网站 /usr/local/prometheus-2.13.0.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.13.0.linux-amd64/prometheus.yml --web.listen-address=:9999 --web.enable-lifecycle

    probe_http_status_code{instance="xxxx",job="web_status"} probe_http_status_code{ ...

  5. What does "exceeded limit of maxWarmingSearchers=X" mean?

    Whenever a commit happens in Solr, a new "searcher" (with new caches) is opened, "war ...

  6. Centos 7.0 execute yum update ——File "/usr/libexec/urlgrabber-ext-down", line 75, in <module> 解决方式

    [打开这个文件:/usr/lib/python2.7/site-packages/urlgrabber/grabber.py找到elif errcode in (42, 55,56)   用  eli ...

  7. Oracle11.2.0.4 RAC GI ORA-15003: diskgroup "XXXX" already mounted in another lock name space

    最新文章:Virson‘s Blog 安装GI,在执行root.sh时报错: Disk Group CRSDG creation failed with the following message: ...

  8. 【转】基于RMAN实现坏块介质恢复(blockrecover)

    本文转自:乐沙弥的世界 对于物理损坏的数据块,我们可以通过RMAN块介质恢复(BLOCK MEDIA RECOVERY)功能来完成受损块的恢复,而不需要恢复整个数据库或所有文件来修复这些少量受损的数据 ...

  9. validate命令---rman进行备份和回复的验证

    rman作为oracle备份与恢复工具,为我们提供了强大的功能.当中包含对数据文件的物理和逻辑检測以及备份文件的有效性检測. 首先.来看一下rman对数据文件的检測. 我们知道,rman在备份数据时, ...

随机推荐

  1. 如何用JavaScript判断dom是否有存在某class的值?

    例如: <html class="no-js"> <head> </head> <body> </body> </ ...

  2. vuejs自定义过滤器根据搜索框输入的值,筛选复杂的列表数据

    如题所示,自定义过滤器根据搜索框输入的值,筛选复杂的列表数据.如图所示: html代码: <input type="text" placeholder="姓名/账号 ...

  3. CentOS7防火墙firewalld设置

    添加80端口  重启后永久生效 firewall-cmd --zone=public --add-port=80/tcp --permanent   查看防火墙状态 systemctl status ...

  4. <自动化测试方案_4>第四章、选型标准

    第四章.选型标准 1,免费 2,工具可维护.可扩展 3,支持团队工作

  5. Django+MongoDB批量插入数据

    在百万级和千万级数据级别进行插入,pymongo的insert_many()方法有着很强的优势.原因是每次使用insert_one()方法进行插入数据,都是要对数据库服务器进行一次访问,而这样的访问是 ...

  6. vue使用axios请求后端数据

    1. 安装axios $ npm install axios 2.在main.js里面导入axios import axios from 'axios' Vue.prototype.$http = a ...

  7. linux vbundle插件配置

    1.新建目录,clone源码 mkdir ~/.vim/bundle/ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vun ...

  8. django 下载文件

    方法一. from django.http import StreamingHttpResponse def big_file_download(request): # do something... ...

  9. 自动化测试基础篇--Selenium获取元素属性

    摘自https://www.cnblogs.com/sanzangTst/p/8375938.html 通常在做断言之前,都要先获取界面上元素的属性,然后与期望结果对比. 一.获取页面title 二. ...

  10. adb 的常见问题与处理办法两三

    问题1:无法安装手机驱动, 解决方法:安装强大的豌豆荚,通常能都能解决问题 问题2: adb devices 时出现 adb devicesadb server is out of date.  ki ...