在有rman备份的情况下,可以使用rman的blockrecover命令实行块恢复。
SYS@orcl>create tablespace test datafile '/u01/app/oracle/oradata/orcl/test01.dbf' size 10m;
Tablespace created.
SYS@orcl>create table scott.test tablespace test as select * from dba_objects where rownum <=100;
Table created.
FILE_ID BLOCK_ID BLOCKS NAME
---------- ---------- ---------- ----------------------------------------------
6 128 8 u01/app/oracle/oradata/orcl/test01.dbf
---备份6号数据文件
RMAN> backup datafile 6;
Starting backup at 14-JAN-13
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=00006 name=/u01/app/oracle/oradata/orcl/test01.dbf
channel ORA_DISK_1: starting piece 1 at 14-JAN-13
channel ORA_DISK_1: finished piece 1 at 14-JAN-13
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_01_14/o1_mf_nnndf_TAG20130114T200736_8h7x896y_.bkp tag=TAG20130114T200736 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-JAN-13
---破坏数据块130和131
[oracle@ora ~]$ dd of=/u01/app/oracle/oradata/orcl/test01.dbf bs=8192 conv=notrunc seek=130 <<EOF
> abcdefghijklmnopqrst
> EOF
0+1 records in
0+1 records out
21 bytes (21 B) copied, 4.6654e-05 s, 450 kB/s
[oracle@ora ~]$ dd of=/u01/app/oracle/oradata/orcl/test01.dbf bs=8192 conv=notrunc seek=131 <<EOF
> abcdefghijklmnopqrst
> EOF
0+1 records in
0+1 records out
21 bytes (21 B) copied, 2.5004e-05 s, 840 kB/s
---验证6号数据文件是否有数据块错误
SYS@orcl>create tablespace test datafile '/u01/app/oracle/oradata/orcl/test01.dbf' size 10m;
Tablespace created.
SYS@orcl>create table scott.test tablespace test as select * from dba_objects where rownum <=100;
Table created.
---test表在6号数据文件,开始于第128号块,共占用8个数据块
FILE_ID BLOCK_ID BLOCKS NAME
---------- ---------- ---------- ----------------------------------------------
6 128 8 u01/app/oracle/oradata/orcl/test01.dbf
---备份6号数据文件
RMAN> backup datafile 6;
Starting backup at 14-JAN-13
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=00006 name=/u01/app/oracle/oradata/orcl/test01.dbf
channel ORA_DISK_1: starting piece 1 at 14-JAN-13
channel ORA_DISK_1: finished piece 1 at 14-JAN-13
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_01_14/o1_mf_nnndf_TAG20130114T200736_8h7x896y_.bkp tag=TAG20130114T200736 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-JAN-13
---破坏数据块130和131
[oracle@ora ~]$ dd of=/u01/app/oracle/oradata/orcl/test01.dbf bs=8192 conv=notrunc seek=130 <<EOF
> abcdefghijklmnopqrst
> EOF
0+1 records in
0+1 records out
21 bytes (21 B) copied, 4.6654e-05 s, 450 kB/s
[oracle@ora ~]$ dd of=/u01/app/oracle/oradata/orcl/test01.dbf bs=8192 conv=notrunc seek=131 <<EOF
> abcdefghijklmnopqrst
> EOF
0+1 records in
0+1 records out
21 bytes (21 B) copied, 2.5004e-05 s, 840 kB/s
---验证6号数据文件是否有数据块错误