Oracle rman备份报错,提示数据文件有坏块,自己查看alert并无报错,说明还没有影响到业务。。
根据报错开始检查确认
[oracle@xx02 ~]$ dbv file='+DATAC1/xxxxdb/datafile/xx_tbs.3223.1044115207' blocksize=8192 userid=sys/xxxxxxx DBVERIFY: Release 11.2.0.4.0 - Production on Mon Nov 22 09:45:59 2021 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = +DATAC1/xxxxdb/datafile/xx_tbs.3223.1044115207 Page 8212 is marked corrupt Corrupt block relative dba: 0xaa402014 (file 681, block 8212) Bad header found during dbv: Data in bad block: type: 122 format: 2 rdba: 0xbadfda7a last change scn: 0xda7a.badfda7a seq: 0xdf flg: 0xba spare1: 0xdf spare2: 0xba spare3: 0xbadf consistency value in tail: 0xbadfda7a check value in block header: 0xda7a block checksum disabled DBVERIFY - Verification complete Total Pages Examined : 655360 Total Pages Processed (Data) : 549193 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 91832 Total Pages Failing (Index): 0 Total Pages Processed (Other): 7163 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 7171 Total Pages Marked Corrupt : 1 >>>>Corrupt Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 0 (0.0)
复制
通过dbv检查发现数据文件确实存在坏块,进一步确认占用坏块的对象
backup validate datafile 681;
[oracle@xx02 ~]$ more /u01/app/oracle/diag/rdbms/xxxxdb/xxxxdb2/trace/xxxxdb2_ora_53650.trc Trace file /u01/app/oracle/diag/rdbms/xxxxdb/xxxxdb2/trace/xxxxdb2_ora_53650.trc Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1 System name: Linux Node name: xx02 Release: 2.6.39-400.250.4.el6uek.x86_64 Version: #1 SMP Tue Jun 2 14:50:33 PDT 2015 Machine: x86_64 Instance name: xxxxdb2 Redo thread mounted by this instance: 2 Oracle process number: 1109 Unix process pid: 53650, image: oracle@xx02 (TNS V1-V3) *** 2021-11-22 09:55:29.441 *** SESSION ID:(3113.16425) 2021-11-22 09:55:29.441 *** CLIENT ID:() 2021-11-22 09:55:29.441 *** SERVICE NAME:(SYS$USERS) 2021-11-22 09:55:29.441 *** MODULE NAME:(backup full datafile) 2021-11-22 09:55:29.441 *** ACTION NAME:(0000015 STARTED19) 2021-11-22 09:55:29.441 Hex dump of (file 681, block 8212) Dump of memory from 0x00007FBE6DF54000 to 0x00007FBE6DF56000 7FBE6DF54000 BADFDA7A BADFDA7A BADFDA7A BADFDA7A [z...z...z...z...] Repeat 511 times Corrupt block relative dba: 0xaa402014 **(file 681, block 8212)** <<<< block 8212 Bad header found during validation Data in bad block: type: 122 format: 2 rdba: 0xbadfda7a last change scn: 0xda7a.badfda7a seq: 0xdf flg: 0xba spare1: 0xdf spare2: 0xba spare3: 0xbadf consistency value in tail: 0xbadfda7a check value in block header: 0xda7a block checksum disabled ksfdrfms:Mirror Read file=+DATAC1/xxxxdb/datafile/xx_tbs.3223.1044115207 fob=0x8b2909ad0 bufp=0x7fbe73460000 blkno=8212 nbytes=8192 ksfdrfms: Read success from mirror side=1 logical extent number=0 disk=DATAC1_CD_09_DM04CEL04 path=o/192.168.10.1;192.168.10.2/DATAC1_CD_dm1 Mirror I/O done from ASM disk o/192.168.10.1;192.168.10.2/DATAC1_CD_dm1 Trying mirror side DATAC1_CD_dm1.
复制
或者通过SQL确认
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 - 1, c.block# + c.blocks - 1) corr_end_block#,
least(e.block_id + e.blocks - 1, c.block# + c.blocks - 1) -
greatest(e.block_id, c.block#) + 1 blocks_corrupted,
null description
FROM dba_extents e, vdatabase_block_corruption c
WHERE e.file_id = c.file#
AND e.block_id <= c.block# + c.blocks - 1
AND e.block_id + e.blocks - 1 >= 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#,
1 blocks_corrupted,
'Segment Header' description
FROM dba_segments s, vdatabase_block_corruption c
WHERE s.header_file = c.file#
AND s.header_block between c.block# and c.block# + c.blocks - 1
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 - 1, c.block# + c.blocks - 1) corr_end_block#,
least(f.block_id + f.blocks - 1, c.block# + c.blocks - 1) -
greatest(f.block_id, c.block#) + 1 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 - 1
AND f.block_id + f.blocks - 1 >= c.block#
order by file#, corr_start_block#;
确认坏块上的段
SQL> SELECT tablespace_name, segment_type, owner, segment_name FROM dba_extents WHERE file_id = &fileid and &blockid between block_id AND block_id + blocks - 1; 2 3 4 Enter value for fileid: 681 old 3: WHERE file_id = &fileid new 3: WHERE file_id = 681 Enter value for blockid: 8212 old 4: and &blockid between block_id AND block_id + blocks - 1 new 4: and 8212 between block_id AND block_id + blocks - 1 TABLESPACE_NAME SEGMENT_TYPE OWNER SEGMENT_NAME ------------------ ------------- ---------- ------------------- xx_tbs TABLE XXX xxx_GROUP_20200721
复制
通过rman恢复
RUN {
ALLOCATE CHANNEL ch00 TYPE ‘SBT_TAPE’;
send ‘NB_ORA_CLIENT=db01-10g’;
blockrecover datafile 681 block 8212;
RELEASE CHANNEL ch00;
}
–end