blockrecover命令是从oracle 9i引入的,可以针对单个数据块的恢复
命令如下:
RMAN> blockrecover datafile 6 block 14;
而在oracle11g推出的recover corruption list命令,更是简化了数据坏块的修复复杂度
只要是在v$database_block_corruption视图中记录的坏块,都会试图修复
下面我们简单的测试一下:
++++首先人为制造几个坏块
RMAN> recover datafile 6 block 50 clear;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
Finished recover at 27-DEC-13
RMAN> recover datafile 6 block 65 clear;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
Finished recover at 27-DEC-13
RMAN> recover datafile 6 block 100 clear;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
Finished recover at 27-DEC-13
RMAN> recover datafile 6 block 102 clear;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
Finished recover at 27-DEC-13
RMAN> recover datafile 6 block 200 clear;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
Finished recover at 27-DEC-13
+++++查看v$database_block_corruption视图
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
6 200 1 0 CHECKSUM
6 102 1 1412463 CHECKSUM
6 100 1 1412463 CORRUPT
6 65 1 1412453 CHECKSUM
6 50 1 1412620 CHECKSUM
+++dbv检测:
[oracle@localhost xiaoming]$ dbv file=/opt/app/oracle/oradata/goolen/goolen01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Fri Dec 27 10:42:07 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /opt/app/oracle/oradata/goolen/goolen01.dbf
Page 50 is marked corrupt
Corrupt block relative dba: 0x01800032 (file 6, block 50)
Bad check value found during dbv:
Data in bad block:
type: 35 format: 2 rdba: 0x01800032
last change scn: 0x0000.00158e0c seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x8e0c2301
check value in block header: 0x8bcc
computed block checksum: 0x7d8b
Page 65 is marked corrupt
Corrupt block relative dba: 0x01800041 (file 6, block 65)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x01800041
last change scn: 0x0000.00158d65 seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x8d650601
check value in block header: 0xf0c2
computed block checksum: 0x3005
Page 100 is marked corrupt
Corrupt block relative dba: 0x01800064 (file 6, block 100)
Bad header found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x01800064
last change scn: 0x0000.00158d6f seq: 0x1 flg: 0xc8
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x8d6f0601
check value in block header: 0xc983
block checksum disabled
Page 102 is marked corrupt
Corrupt block relative dba: 0x01800066 (file 6, block 102)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x01800066
last change scn: 0x0000.00158d6f seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x8d6f0601
check value in block header: 0xaee0
computed block checksum: 0x339
Page 200 is marked corrupt
Corrupt block relative dba: 0x018000c8 (file 6, block 200)
Bad check value found during dbv:
Data in bad block:
type: 0 format: 2 rdba: 0x018000c8
last change scn: 0x0000.00000000 seq: 0x1 flg: 0x05
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00000001
check value in block header: 0xa648
computed block checksum: 0x36b3
DBVERIFY - Verification complete
Total Pages Examined : 1328
Total Pages Processed (Data) : 1041
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 2
Total Pages Failing (Index): 0
Total Pages Processed (Other): 24
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 256
Total Pages Marked Corrupt : 5
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1412617 (0.1412617)
++++可以看出,oracle检测出了5个坏块
++++现在我们不需要去指定每一个坏块去恢复,只需要执行一条命令,oracle就会去尝试恢复v$database_block_corruption视图中记录的坏块
+++执行恢复
RMAN> recover corruption list;
Starting recover at 27-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00006
channel ORA_DISK_1: reading from backup piece /opt/app/oracle/product/11.2.0/dbs/19osiaap_1_1
channel ORA_DISK_1: piece handle=/opt/app/oracle/product/11.2.0/dbs/19osiaap_1_1 tag=TAG20131227T103505
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 27-DEC-13
++++再次查看v$database_block_corruption
SQL> select * from v$database_block_corruption;
no rows selected
+++我们可以看到,视图中记录的坏块已经成功恢复
+++dbv检测:
[oracle@localhost xiaoming]$ dbv file=/opt/app/oracle/oradata/goolen/goolen01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Fri Dec 27 10:42:52 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /opt/app/oracle/oradata/goolen/goolen01.db
DBVERIFY - Verification complete
Total Pages Examined : 1328
Total Pages Processed (Data) : 1044
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 2
Total Pages Failing (Index): 0
Total Pages Processed (Other): 25
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 257
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1412620 (0.1412620)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23249684/viewspace-1155877/
,如需转载,请注明出处,否则将追究法律责任。