rman备份报错,全zero错误处理一例(bbed)
问题:某数据库在执行rman全备的时候,发现alert日志中有报错,报错提示, file 10,block 305076全部为zero,内容全零,处理过程如下
分析处理:
1. 这个问题可能是 系统或者oraclebug导致,也可能是磁盘故障,断电等导致的。
2. 这个坏块
- 如果是包含有用数据的块,那么只能根据备份来进行恢复,(块恢复,或者文件恢复)。
- 如果是不包含有用数据的块,就是说这个块不属于任何段segment,(table ,index等) ,那么可以进行一些特殊的手法来处理。
针对第二种情况,这个块没被使用,MOS上有个官方的解决方案《如何格式化不属于任何段的损坏块 (Doc ID 1526163.1)》,这个方案的方法思路就是,通过脚本创建一个表,往里每次小量的插入数据,从而把这个zero的块给重新格式化并填充。
这个方法是安全的,并且是推荐的,但是我在实际的使用中,并没有重复的分配到这个块的extent给segment使用,老是跳过这个extent,直接扩大了datafile来装入新插入的数据。
所以这里我就使用了bbed来模拟一个块来欺骗oracle的方法来规避这个问题。
说明: file 10,block 305076,305076这个块通过查询dba_extent发现,是个 区中块,前后都有数据块,不是段头和位图块,更简单一些,这里选用其前的 305075块来参考 创建并覆盖305076这个块。
1. rman备份报 zero block错误。因为这块extent已经是空闲的,考虑将305076之前的块305075,拷贝到305076,修改rdba来欺骗oracle,之后这个空闲块被重新利用的时候,会被格式化
[oracle@db bbed64]$ bbed filename='/oradata/db/db_index03.dbf' Password: BBED: Release 2.0.0.0.0 - Limited Production on Wed Jan 23 10:30:11 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> show all; FILE# 0 BLOCK# 1 OFFSET 0 DBA 0x00000000 (0 0,1) FILENAME /oradata/db/db_index03.dbf BIFILE bifile.bbd LISTFILE BLOCKSIZE 8192 MODE Browse EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No BBED> show mode; MODE Browse BBED> set mode edit; MODE Edit BBED> set block 305076; BLOCK# 305076 BBED> show all; FILE# 0 BLOCK# 305076 OFFSET 0 DBA 0x00000000 (0 0,305076) FILENAME /oradata/db/db_index03.dbf BIFILE bifile.bbd LISTFILE BLOCKSIZE 8192 MODE Edit EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No BBED> d File: /oradata/db/db_index03.dbf (0) Block: 305076 Offsets: 0 to 511 Dba:0x00000000 ------------------------------------------------------------------------ 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> 将305075 拷贝到 305076 BBED> copy block 305075 to block 305076 File: /oradata/db/db_index03.dbf (0) Block: 305076 Offsets: 0 to 511 Dba:0x00000000 ------------------------------------------------------------------------ 06a20000 b3a78402 417c7807 00000104 6a180000 02000000 28e90100 9e354e07 00000000 02003200 01a68402 13000f00 bb2b0000 eef6c302 ec010200 00800000 ea377403 29000300 fe780000 a564c500 46053400 00800000 201e6e06 00000000 00000000 00008002 01000000 1b015a02 4b08af0b 00000000 d7b28402 81b98402 00000000 601f0000 65117511 41098511 9511a511 b511c511 d511e511 b50ff511 05126510 15122412 34124412 32095412 64127412 84129412 a412b412 c312d312 e312f312 03131213 22133213 42135113 60136e13 7c138c13 9c13ac13 bb13ca13 d913e813 f713670a 06141614 26143614 46145614 66147614 86149614 a614b614 c414d414 e414f414 04151415 24153415 25114415 a0094b08 67085908 54156415 4510c70a 74158415 9415a415 b315a60f 1b0a960f dd09c315 d315a70b 0b0ae315 f315d510 03161316 23163316 43165316 63167316 82169116 a016af16 ed09ce09 fc09be16 ce16de16 ee16fe16 3e0d8c0d 7c0d0e17 1e172e17 3e174e17 5e176e17 7e178e17 3511190f 15109e17 ae17770b be17670f c50f570c ce17f10c 1309de17 ee17fe17 0e181e18 2e183e18 4e18f510 e5105d18 6d187d18 8d189d18 ad18bd18 cd18dd18 ed18fd18 0d191d19 2d193d19 4d195d19 6d197d19 8d199d19 5510ad19 bd19cd19 dd19ed19 fd190d1a 1c1a2c1a 3c1a4c1a 5c1a6b1a 7a1a891a 981aa71a <32 bytes per line> BBED> show block BLOCK# 305076 BBED> sum Check value for File 0, Block 305076: current = 0x186a, required = 0x186a BBED> v DBVERIFY - Verification starting FILE = /oradata/db/db_index03.dbf BLOCK = 305076 Block 305076 is corrupt Corrupt block relative dba: 0x0284a7b4 (file 0, block 305076) Bad header found during verification Data in bad block: type: 6 format: 2 rdba: 0x0284a7b3 last change scn: 0x0000.07787c41 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x7c410601 check value in block header: 0x186a computed block checksum: 0x0 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 1 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED 发现过不了校验 因为块里还是记录的源块的 rdba,需要从rdba: 0x0284a7b3 改为 rdba: 0x0284a7b4
BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x06 ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x0284a7b3 ub4 bas_kcbh @8 0x07787c41 ub2 wrp_kcbh @12 0x0000 ub1 seq_kcbh @14 0x01 ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x186a ub2 spare3_kcbh @18 0x0000 BBED> set offset 4 OFFSET 4 BBED> d /v count=4 BBED-00202: invalid parameter (=) BBED> d /v count 4 File: /oradata/db/db_index03.dbf (0) Block: 305076 Offsets: 4 to 7 Dba:0x00000000 ------------------------------------------------------- b3a78402 l .... <16 bytes per line> BBED> m /x b4 File: /oradata/db/db_index03.dbf (0) Block: 305076 Offsets: 4 to 7 Dba:0x00000000 ------------------------------------------------------------------------ b4a78402 <32 bytes per line> BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x06 ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x0284a7b4 ub4 bas_kcbh @8 0x07787c41 ub2 wrp_kcbh @12 0x0000 ub1 seq_kcbh @14 0x01 ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x186a ub2 spare3_kcbh @18 0x0000 BBED> v DBVERIFY - Verification starting FILE = /oradata/db/db_index03.dbf BLOCK = 305076 Block 305076 is corrupt Corrupt block relative dba: 0x0284a7b4 (file 0, block 305076) Bad check value found during verification Data in bad block: type: 6 format: 2 rdba: 0x0284a7b4 last change scn: 0x0000.07787c41 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x7c410601 check value in block header: 0x186a computed block checksum: 0x7 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 1 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED BBED> sum Check value for File 0, Block 305076: current = 0x186a, required = 0x186d BBED> sum apply Check value for File 0, Block 305076: current = 0x186d, required = 0x186d BBED> v DBVERIFY - Verification starting FILE = /oradata/db/db_index03.dbf BLOCK = 305076 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 1 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 Message 531 not found; product=RDBMS; facility=BBED
校验: