ORACLE SOS

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4302|回复: 0

Oracle rman 检测坏块

[复制链接]

95

主题

266

帖子

1719

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1719
发表于 2018-7-12 12:30:24 | 显示全部楼层 |阅读模式

  1. rman target /

  2. RMAN> configure device type disk parallelism 4;
  3. RMAN> backup validate check logical database;


  4. sqlplus / as sysdba
  5. spool /tmp/xifenfei.txt
  6. set pagesize 2000
  7.          set linesize 250
  8.      SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file#
  9.      , greatest(e.block_id, c.block#) corr_start_block#
  10.      , least(e.block_id+e.blocks-1, c.block#+c.blocks-1) corr_end_block#
  11.      , least(e.block_id+e.blocks-1, c.block#+c.blocks-1)
  12.        - greatest(e.block_id, c.block#) + 1 blocks_corrupted
  13.      , null description
  14.   FROM dba_extents e, v$database_block_corruption c
  15. WHERE e.file_id = c.file#
  16.    AND e.block_id <= c.block# + c.blocks - 1
  17.    AND e.block_id + e.blocks - 1 >= c.block#
  18. UNION
  19. SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file#
  20.      , header_block corr_start_block#
  21.      , header_block corr_end_block#
  22.      , 1 blocks_corrupted
  23.      , 'Segment Header' description
  24.   FROM dba_segments s, v$database_block_corruption c
  25. WHERE s.header_file = c.file#
  26.    AND s.header_block between c.block# and c.block# + c.blocks - 1
  27. UNION
  28. SELECT null owner, null segment_type, null segment_name, null partition_name, c.file#
  29.      , greatest(f.block_id, c.block#) corr_start_block#
  30.      , least(f.block_id+f.blocks-1, c.block#+c.blocks-1) corr_end_block#
  31.      , least(f.block_id+f.blocks-1, c.block#+c.blocks-1)
  32.        - greatest(f.block_id, c.block#) + 1 blocks_corrupted
  33.      , 'Free Block' description
  34.   FROM dba_free_space f, v$database_block_corruption c
  35. WHERE f.file_id = c.file#
  36.    AND f.block_id <= c.block# + c.blocks - 1
  37.    AND f.block_id + f.blocks - 1 >= c.block#
  38. order by file#, corr_start_block#;
  39. /
  40. spool off
复制代码



Q Q:107644445
Tel:13429648788
Email:dba@xifenfei.com
个人Blog(惜分飞)
提供专业ORACLE技术支持(数据恢复,安装实施,升级迁移,备份容灾,故障诊断,系统优化等)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|ORACLE SOS 技术论坛

GMT+8, 2024-12-5 03:18 , Processed in 0.017057 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表