返回顶部
首页 > 资讯 > 数据库 >利用dbms_repair来标记和跳过坏块
  • 550
分享到

利用dbms_repair来标记和跳过坏块

2024-04-02 19:04:59 550人浏览 八月长安
摘要

sql> select file_id, block_id, blocks from dba_extents wher&

sql> select file_id, block_id, blocks from dba_extents where owner = 'LILC' and segment_name = 'TEST';
,,,,,
 610624    1024
 611648    1024
83 rows selected.

破坏之前的数据:

SQL> select count(*) from test;

  COUNT(*)

----------

    783018

RMAN> recover datafile 6 block 11620 clear;

RMAN> recover datafile 6 block 4467 clear;

RMAN> backup check logical validate datafile 6;

Starting backup at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

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=+DATA/phub/datafile/llc01.dbf

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

List of Datafiles

=================

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN

---- ------ -------------- ------------ --------------- ----------

6    FaiLED 0              20           12800           1991935   

  File Name: +DATA/phub/datafile/llc01.dbf

  Block Type Blocks Failing Blocks Processed

  ---------- -------------- ----------------

  Data       2              12140           

  Index      0              329             

  Other      1              311             

validate found one or more corrupt blocks

See trace file /u01/app/oracle/diag/rdbms/phub/PHUB/trace/PHUB_ora_29666.trc for details

Finished backup at 23-SEP-15

数据查询肯定报错:

SQL> select count(*) from test;

select count(*) from test

*

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 6, block # 4467)

ORA-01110: data file 6: '+DATA/phub/datafile/llc01.dbf'

skip_corrupt_blocks来跳过坏块:

SQL> exec dbms_repair.skip_corrupt_blocks(schema_name => 'LILC',object_name => 'TEST',flags => 1);

PL/SQL procedure successfully completed.

SQL> conn lilc/lilc;

Connected.

SQL> select count(*) from test;


  COUNT(*)

----------

    782884


这里少了34条数据

修复坏块;

RMAN> recover datafile 6 block 11620

2> ;

Starting recover at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

finished standby search, restored 1 blocks

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 23-SEP-15

RMAN> recover datafile 6 block 4467

Starting recover at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

finished standby search, restored 1 blocks

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 23-SEP-15

数据正常:

SQL> select count(*) from test;


  COUNT(*)

----------

    783018


您可能感兴趣的文档:

--结束END--

本文标题: 利用dbms_repair来标记和跳过坏块

本文链接: https://lsjlt.com/news/49566.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作