RMAN blockrecover命令恢复数据块

    在有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.

---test表在6号数据文件,开始于第128号块,共占用8个数据块

SYS@orcl>select a.file_id,a.block_id,a.blocks,b.name from dba_extents a,v$datafile b  where a.file_id=b.file# and a.owner='SCOTT' and a.segment_name='TEST';

   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号数据文件是否有数据块错误
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值