问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

如何使用 RMAN 识别数据库中损坏的对象

发布网友 发布时间:2022-04-30 10:11

我来回答

2个回答

懂视网 时间:2022-04-30 14:32

02-SEP-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=141 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=9 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u02/app/oradata/ORCL/system01.dbf input datafile file number=00006 name=/u02/app/oradata/ORCL/rlst01.dbf input datafile file number=00005 name=/u02/app/oradata/ORCL/mssm01.dbf channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00002 name=/u02/app/oradata/ORCL/sysaux01.dbf input datafile file number=00003 name=/u02/app/oradata/ORCL/undotbs01.dbf input datafile file number=00004 name=/u02/app/oradata/ORCL/users01.dbf channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 2 OK 0 17775 84503 3456527 File Name: /u02/app/oradata/ORCL/sysaux01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 20940 Index 0 17430 Other 0 28335 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 3 OK 0 1 26893 3456665 File Name: /u02/app/oradata/ORCL/undotbs01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 26879 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 4 OK 0 14 643 2732847 File Name: /u02/app/oradata/ORCL/users01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 48 Index 0 2 Other 0 576 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- Control File OK 0 614 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set including current SPFILE in backup set channel ORA_DISK_2: backup set complete, elapsed time: 00:00:00 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- SPFILE OK 0 2 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:42 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 13138 88333 3456665 File Name: /u02/app/oradata/ORCL/system01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 59322 Index 0 12665 Other 0 3195 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 5 OK 0 12670 12800 1408151 File Name: /u02/app/oradata/ORCL/mssm01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 2 Index 0 0 Other 0 128 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 6 OK 0 22441 25600 2098889 File Name: /u02/app/oradata/ORCL/rlst01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 2739 Index 0 158 Other 0 262 Finished backup at 02-SEP-15

 

利用数据字典表查询是否有坏块

SQL> desc v$database_block_corruption
 Name     Null? Type
 ----------------------------------------- -------- ----------------------------
 FILE#      NUMBER
 BLOCK#      NUMBER
 BLOCKS      NUMBER
 CORRUPTION_CHANGE#     NUMBER
 CORRUPTION_TYPE     VARCHAR2(9)

SQL> select * from v$database_block_corruption;

no rows selected

 

 

如果存在坏块可使用以下脚本查询:

SELECT e.owner,
 e.segment_type,
 e.segment_name,
 e.partition_name,
 c.file#,
 greatest(e.block_id, c.block#) corr_start_block#,
 least(e.block_id + e.blocks - 1, c.block# + c.blocks - 1) corr_end_block#,
 least(e.block_id + e.blocks - 1, c.block# + c.blocks - 1) -
 greatest(e.block_id, c.block#) + 1 blocks_corrupted,
 null description
 FROM dba_extents e, v$database_block_corruption c
 WHERE e.file_id = c.file#
 AND e.block_id <= c.block# + c.blocks - 1
 AND e.block_id + e.blocks - 1 >= c.block#
UNION
SELECT s.owner,
 s.segment_type,
 s.segment_name,
 s.partition_name,
 c.file#,
 header_block corr_start_block#,
 header_block corr_end_block#,
 1 blocks_corrupted,
 ‘Segment Header‘ description
 FROM dba_segments s, v$database_block_corruption c
 WHERE s.header_file = c.file#
 AND s.header_block between c.block# and c.block# + c.blocks - 1
UNION
SELECT null owner,
 null segment_type,
 null segment_name,
 null partition_name,
 c.file#,
 greatest(f.block_id, c.block#) corr_start_block#,
 least(f.block_id + f.blocks - 1, c.block# + c.blocks - 1) corr_end_block#,
 least(f.block_id + f.blocks - 1, c.block# + c.blocks - 1) -
 greatest(f.block_id, c.block#) + 1 blocks_corrupted,
 ‘Free Block‘ description
 FROM dba_free_space f, v$database_block_corruption c
 WHERE f.file_id = c.file#
 AND f.block_id <= c.block# + c.blocks - 1
 AND f.block_id + f.blocks - 1 >= c.block#
 order by file#, corr_start_block#;
SELECT tablespace_name, segment_type, owner, segment_name
FROM dba_extents
WHERE file_id = &fileid
and &blockid between block_id AND block_id + blocks - 1;

 

 

参考:http://www.cnblogs.com/macleanoracle/archive/2013/03/19/2968101.html

[转]RMAN检测数据库坏块

标签:

热心网友 时间:2022-04-30 11:40

步骤1:识别坏块
执行下面的 RMAN 命令,使所有的坏块信息被记录在 v$database_block_corruption 视图中:
RMAN> backup validate check logical database;
注意:
这个命令只是检查数据库的坏块,而不会真正进行备份。从 11g 开始可以省略 backup 子句,而直接使用命令"validate check logical database"。
如果由于缺失文件导致命令失败,可以增加 'SKIP INACCESSIBLE' 子句来避免这个问题。
为了加快检查速度,可以设置 PARALLELISM 指定多个通道:
RMAN> configure device type disk parallelism 4;
RMAN> backup validate check logical database;
OR
RMAN> run {
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
backup validate check logical database;
}
输出
坏块信息会被记录在视图 V$DATABASE_BLOCK_CORRUPTION 中。11g RMAN 会生成一个 trace 文件,详细描述坏块信息:
RMAN VALIDATE 屏幕输出:
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
6 FAILED 0 501 640 1950088
File Name: /oracle/dbs/users.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 9 9
Index 0 0
Other 0 130
validate found one or more corrupt blocks
See trace file /oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_28424.trc for details
Finished validate at <Date>
Trace 文件输出坏块信息,这个例子描述了 2 个坏块,一个物理坏块(file 6 block 9)和一个逻辑坏块(file 6 block 10):
Corrupt block relative dba: 0x01000009 (file 4, block 9)
Bad check value found ring validation
Data in bad block:
type: 16 format: 2 rdba: 0x01000009
last change scn: 0x0000.00000000 seq: 0xff flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x000010ff
check value in block header: 0xb4e0
computed block checksum: 0xa800
Reread of blocknum=9, file=/oracle/dbs/users.dbf found same corrupt data
Block Checking: DBA = 25165834, Block Type = KTB-managed data block
data header at 0x2b2deb49e07c
kdbchk: fsbo(144) wrong, (hsz 78)
Error backing up file 6, block 10: logical corruption
坏块信息记录在视图 V$DATABASE_BLOCK_CORRUPTION 中:
SQL> select * from V$DATABASE_BLOCK_CORRUPTION;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
--------------- --------------- --------------- ------------------ ---------
6 10 1 8183236781662 LOGICAL
6 42 1 0 FRACTURED
6 34 2 0 CHECKSUM
6 50 1 8183236781952 LOGICAL
6 26 4 0 FRACTURED
5 rows selected.
注意:
•CHECK LOGICAL 选项既会检查
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
现在厨师一个月工资是多少,炒菜和配菜,在什 成都厨房工资多少钱一个月 现在厨师一个月工资是多少,炒菜和配菜,在什么地方的价格,请详细点,谢 ... 华硕电脑上没有触摸板设置华硕笔记本电脑触摸板怎么开启 新买的光碟DVD-R是空白的,我想把他制作成一个系统光碟,谁知道怎么制 ... 请问空白光盘刻录车载DVD后,播放时只有目录放不出来是怎么回事啊?_百 ... 请问将一张DVD-R空白光盘作为数据盘使用能够重复写入或者续写数据吗?谢 ... 我现在有DVD-R盘,怎样刻录?一定需要刻录机吗? 做辣椒酱为什么要放酒 做辣椒酱为啥要放酒 2024年区块链的趋势和方向 qmax4m3/h的燃气表是多大 微信实名认证后QQ实名认证对微信有影响或者是信息吗 为什么腾讯成长守护,QQ实名了微信不能实名? 王者荣耀微信和QQ实名认证用的同一身份证号,健康系统的两个小时是微信QQ共用的吗_百度问一问 cf手游的实名认证的QQ版和微信版是互联的吗? 只要有一个手机在微信上认证了,用其他手机QQ登录跟微信同样的实名认证,可以正常进游戏吗? 王者荣耀微信和QQ实名认证用的同一身份证号,健康系统的两个小时是微信Q... 王者QQ实名认证了,微信还可以弄吗? 企业制定广告预算的方法有哪些?各自的优缺点是什么? 广告预算的名词解释 预算广告费的支出怎么计算 怎么样评价广告是否有效 如何来制定年度广告的预算 广告预算是什么 简述确定广告预算的方法 如何科学制定年度广告预算 如何准确地评估广告效果 企业确定广告预算的方法包括 越南赛区退赛,拳头改规则,LCK会成为最大的赢家吗? LOL手游KDA女团任务怎么开启啊? 女生说男生你个老六是什么意思 有人觉得infi和yumiko比他和三蛋跟配的吗? 仿盛大传奇1.80 1.85星王发布站 怎么破解gm权限 哪位好心人给个新开1.85神龙终极合击的地址或发布站点啊! 如何评价巅峰时期的sky和如今的三大人族th000,infi,yumiko的实力 传奇1.85似服在哪个发布网发广告效果好啊 传奇1.85完整客户端 中韩对抗赛为什么没有yumiko 谁有好的传奇私F介绍,要1.85或1.86版本的? 魔兽争霸各种族最强的选手分别是谁? 找个传奇1.85版的SF 各位认为当前的魔兽选手中,sky,tod,三蛋,infi,还有退役的inso,谁是人类的第一人呢? 传奇发布网那个比较好 ecl2011魔兽争霸3和Yumiko一起解说的女解说是谁 传奇1.85英雄合击服务端谁有啊? wca2014魔兽争霸谁是冠军 太久没关注war3了,现在war3四大种族各第一名是谁?人族还是sky?兽族grubby?不死fov?暗夜moon? 现在国内和世界各种族最强魔兽争霸选手分别是谁? 1.85星王传奇有名教总坛光明顶的,谁知道现在还有这样的版本吗?知道的回个。。。谢谢 魔兽选手中谁的apm最高?dota中谁的最高?