alert日志报以下提示:

 Corrupt block relative dba: 0x04c20df1 (file 19, block 134641)
Fractured block found during backing up datafile
Data in bad block:
type: 40 format: 2 rdba: 0x04c20df1
last change scn: 0x0000.189926c6 seq: 0x2 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x26c52802
check value in block header: 0xd25a
computed block checksum: 0x28b1
Reread of blocknum=134641, file=/oradata/omsdb1/OMS_DATA12.dbf. found same corrupt data
Reread of blocknum=134641, file=/oradata/omsdb1/OMS_DATA12.dbf. found same corrupt data
Reread of blocknum=134641, file=/oradata/omsdb1/OMS_DATA12.dbf. found same corrupt data
Reread of blocknum=134641, file=/oradata/omsdb1/OMS_DATA12.dbf. found same corrupt data
Reread of blocknum=134641, file=/oradata/omsdb1/OMS_DATA12.dbf. found same corrupt data

根据上述信息得知19号数据文件的134641为坏块,可以使用DBV工具或者RMAN来检查坏块信息

dbv:

 [oracle@ASZAAS-OMS01 ~]$ dbv file=/oradata/omsdb1/OMS_DATA12.dbf

 DBVERIFY: Release 11.2.0.4.0 - Production on Fri Jun 29 10:57:30 2018

 Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 DBVERIFY - Verification starting : FILE = /oradata/omsdb1/OMS_DATA12.dbf
Page 134641 is influx - most likely media corrupt
Corrupt block relative dba: 0x04c20df1 (file 19, block 134641)
Fractured block found during dbv:
Data in bad block:
type: 40 format: 2 rdba: 0x04c20df1
last change scn: 0x0000.189926c6 seq: 0x2 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x26c52802
check value in block header: 0xd25a
computed block checksum: 0x28b1 DBVERIFY - Verification complete Total Pages Examined : 3932160
Total Pages Processed (Data) : 164199
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 9003
Total Pages Failing (Index): 0
Total Pages Processed (Other): 3757308
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 1649
Total Pages Marked Corrupt : 1
Total Pages Influx : 1
Total Pages Encrypted : 0
Highest block SCN : 421782991 (0.421782991)

rman:

 RMAN> backup validate datafile 19;

 Starting backup at 29-JUN-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00019 name=/oradata/omsdb1/OMS_DATA12.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:08:16
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
19 FAILED 0 1649 3932160 421804976
File Name: /oradata/omsdb1/OMS_DATA12.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 164199
Index 0 9001
Other 1 3757311 validate found one or more corrupt blocks
See trace file /u01/app/oracle/diag/rdbms/omsdb1/omsdb1/trace/omsdb1_ora_20078.trc for details
Finished backup at 29-JUN-18

可以根据文件号和块号查出损坏的是对象,表还是LOB segment

 select tablespace_name,segment_type,owner,segment_name from dba_extents where file_id=19 and 134641 between block_id AND block_id + blocks - 1;

19是文件号,134641是block号

如果是对象,可以重建:

alter index indexname rebuild

如果是表,可以使用10231事件忽略坏块,然后使用CTAS方式重建表最后rename table,别忘记rebuild index

alter session SET EVENTS '10231 trace name context forever,level 10';
create table tab_new as select * from tab;
rename tab to tab_bak;
rename tab_new to new;
alter index indexname rebuild;
alter session SET EVENTS '10231 trace name context off';

如果损坏的是LOB segment,先找出segment信息:

select owner, segment_name, segment_type from dba_extents where file_id = 19 and 134641 between block_id and block_id + blocks - 1;

输出如下:

 owner=OMSADMIN
segment_name=SYS_LOB0000087489C00007$$
segment_type=LOBSEGMENT

找到表名和LOB字段:

 select table_name, column_name from dba_lobs where segment_name = 'SYS_LOB0000087489C00007$$' and owner = 'OMSADMIN';

输出如下:

 table_name = OMS_LOGINFOR
column_name = CONTENT

找到坏块的bad rowid,使用以下plsql脚本:

 create table bad_rows (row_id ROWID,oracle_error_code number);

 declare
n number;
error_code number;
bad_rows number := 0;
ora1578 EXCEPTION;
PRAGMA EXCEPTION_INIT(ora1578, -1578);
begin
for cursor_lob in (select rowid rid, &lob_column from &table_owner.&table_with_lob) loop
begin
n:=dbms_lob.instr(cursor_lob.&lob_column,hextoraw('')) ;
exception
when ora1578 then
bad_rows := bad_rows + 1;
insert into bad_rows values(cursor_lob.rid,1578);
commit;
when others then
error_code:=SQLCODE;
bad_rows := bad_rows + 1;
insert into bad_rows values(cursor_lob.rid,error_code);
commit;
end;
end loop;
dbms_output.put_line('Total Rows identified with errors in LOB column: '||bad_rows);
end;
/

Enter value for lob_column: CONTENT
Enter value for table_owner: OMSADMIN
Enter value for table_with_lob: OMS_LOGINFOR 
可以查询bad rowid

select * from bad_rows;
ROW_ID ORACLE_ERROR_CODE
1 AABIz+AATAAAf2jAAB 1578
2 AABIz+AATAAAf2zAAA -1555
3 AABIz+AATAAAf2zAAB -1555
4 AABIz+AATAAAf7kAAA -1555

更新空LOB字段来避免ORA-1578,ORA-26040,如果是CLOB类型,将empty_blob()改为empty_clob()

update &table_owner.&table_with_lob set &lob_column = empty_clob() where rowid in (select row_id from bad_rows);

将bad rowid lob块移到其他表空间:

 alter table &table_owner.&table_with_lob move LOB (&lob_column) store as (tablespace &tablespace_name);

最后重建索引rebuild index

最新文章

  1. [Android]使用MVP解决技术债务(翻译)
  2. HOLOLENS 扫描特效 及得出扫描结果(SurfacePlane)
  3. {POJ}{3988}{Software Industry Revolution}{DP好题}
  4. 你真的了解UIWindow吗?
  5. C#笔记---动态类(Dynamic)应用
  6. JavaScript实现字符串的contains函数
  7. 构造函数创建对象和Object.create()实现继承
  8. 对list进行切片
  9. SQL性能优化(Oracle)
  10. navicat使用跳板机连接数据库-ssh
  11. strip_tags,htmlspecialchars,htmlentities,stripslashes,addslashes学习小结
  12. poj3347Kadj Squares
  13. Assembly 'Microsoft.Office.Interop.Excel
  14. javascript笔记整理(字符串对象)
  15. Java 异常分类
  16. Sticks<DFS>
  17. netty 对 protobuf 协议的解码与包装探究(2)
  18. OC—可变数组NSMutableArray
  19. js版贪吃蛇
  20. grep&正则表达式

热门文章

  1. python实现栈的算法
  2. 黑箱中的 retain 和 release
  3. 待解决问题:c++栈对象的析构、虚拟内存与内存管理的关系、内存管理的解决方案。
  4. 获取Bing每日壁纸用作首屏大图
  5. 文件系统inodes使用率过高问题处理
  6. 第十一篇、UITableView headerview下拉放大
  7. rand()和srand()
  8. advanced regression to predict housing prices
  9. 线程池是什么?Java四种线程池的使用介绍
  10. JZOJ 5793. 【NOIP2008模拟】小S练跑步