分享
 
 
 

Oracle内部工具Block Corruption介绍

王朝oracle·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

有人在Google新闻组上提出了一个问题:“How can I get the BBED passWord?”,继而引发了一场很有意思的讨论。

后来Pete Finnigan也在他的Blog写了一篇文章"An interesting thread on Oracle-l about BBED"描述这次有意思的探讨。

在讨论中,有一个有趣的观点提到,假如这个工具被广泛传播,那么可能有些人不是用BBED来修复数据,意外的破坏可能更为多见。最终的后果可能是Oracle彻底把这个工具移除。BBED是Block Browser/Editor的缩写,是Oracle的一个内部工具,不对外发布文档及支持。BBED随软件发布,但是我们需要进行简单的relink才能使用,relink请参考:How to compile Oracle10g BBED tools.

虽然BBED工具的使用存在很多风险,但是假如利用得当,可以以之解决很多棘手的问题。本文简单介绍一下如何用BBED模拟坏块,以练习坏块修复等技术,此前我曾经介绍过另外一种方法,请参考:Oracle中模拟及修复数据块损坏

1.创建测试表

[oracle@jumper conner]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - ProdUCtion on Sun Sep 11 19:59:27 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

SQL> create table bbed tablespace users as select * from dba_tables;

Table created.

SQL> select count(*) from bbed;

COUNT(*)

523

SQL> col segment_name for a10

SQL> select segment_name,file_id,block_id from

dba_extents where segment_name='BBED';

SEGMENT_NA FILE_ID BLOCK_ID

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

BBED 3 9

BBED 3 17

BBED 3 25

SQL> select count(*) from bbed;

COUNT(*)

523

2.创建BBED参数文件等。

[oracle@jumper conner]$ more filelist.txt

1 /opt/oracle/oradata/conner/system01.dbf 440401920

2 /opt/oracle/oradata/conner/undotbs01.dbf 104857600

3 /opt/oracle/oradata/conner/users01.dbf 27262976

[oracle@jumper conner]$ more par.bbd

blocksize=8192

listfile=filelist.txt

mode=edit

3.使用BBED

[oracle@jumper conner]$ bbed parfile=par.bbd

Password:

BBED: Release 2.0.0.0.0 - Limited Production on Sun Sep 11 20:01:01 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> set file 3

FILE# 3

BBED> show

FILE# 3

BLOCK# 1

OFFSET 0

DBA 0x00c00001 (12582913 3,1)

FILENAME /opt/oracle/oradata/conner/users01.dbf

BIFILE bifile.bbd

LISTFILE filelist.txt

BLOCKSIZE 8192

MODE Edit

EDIT Unrecoverable

IBASE Dec

OBASE Dec

WIDTH 80

COUNT 512

LOGFILE log.bbd

SPOOL No

4.回滚误操作

假如操作中发生误操作,可以使用revert命令回滚。

BBED> modify /x 0x00c00011

File: /opt/oracle/oradata/conner/users01.dbf (3)

Block: 1 Offsets: 1000 to 1511 Dba:0x00c00001

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

00c00011 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> revert

All changes made in this session will be rolled back. Proceed? (Y/N) Y

Reverted file '/opt/oracle/oradata/conner/users01.dbf', block 1

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y

5.改写数据块

模拟坏块:

BBED> modify 1000 file 3 block 17

File: /opt/oracle/oradata/conner/users01.dbf (3)

Block: 17 Offsets: 1000 to 1511 Dba:0x00c00011

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

03e80000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 002c002f 03535953 18415050 4c59245f 434f4e46 5f48444c

525f434f 4c554d4e 53065359 5354454d ffff02c1 0b02c129 02c10203 c2033804

c3073825 ff02c102 06c51630 31252eff 02c10202 c1020359 4553014e ffffffff

ffffffff 0a202020 20202020 2020310a 20202020 20202020 20310520 2020204e

07454e41 424c4544 ffff024e 4fff014e 014e024e 4f074445 4641554c 54084449

5341424c 4544024e 4f024e4f ff084449 5341424c 4544024e 4fff0844 49534142

4c454408 44495341 424c4544 2c002f03 53595314 4150504c 59245f45 52524f52

5f48414e 444c4552 06535953 54454dff ff02c10b 02c12902 c10203c2 033804c3

073825ff 02c10206 c5163031 252eff02 c10202c1 02035945 53014eff ffffffff

ffffff0a 20202020 20202020 20310a20 20202020 20202020 31052020 20204e07

454e4142 4c4544ff ff024e4f ff014e01 4e024e4f 07444546 41554c54 08444953

41424c45 44024e4f 024e4fff 08444953 41424c45 44024e4f ff084449 5341424c

45440844 49534142 4c45442c 002f0353 59530c41 50504c59 245f4552 524f5206

<32 bytes per line>

6.检查数据块损坏

使用verify命令,可以发现刚才修改的file 3 block 17已经被标记为损坏。

BBED> verify

DBVERIFY - Verification starting

FILE = /opt/oracle/oradata/conner/users01.dbf

BLOCK = 17

Block 17 is corrupt

***

Corrupt block relative dba: 0x00c00011 (file 0, block 17)

Bad check value found during verification

Data in bad block -

type: 6 format: 2 rdba: 0x00c00011

last change scn: 0x0000.20a3b575 seq: 0x1 flg: 0x04

consistency value in tail: 0xb5750601

check value in block header: 0x3006, computed block checksum: 0xe803

spare1: 0x0, spare2: 0x0, spare3: 0x0

***

DBVERIFY - Verification complete

Total Blocks Examined : 1

Total Blocks Processed (Data) : 0

Total Blocks Failing (Data) : 0

Total Blocks Processed (Index): 0

Total Blocks Failing (Index): 0

Total Blocks Empty : 0

Total Blocks Marked Corrupt : 1

Total Blocks Influx : 0

BBED> quit

7.使用DBV检查

[oracle@jumper conner]$ dbv file=users01.dbf blocksize=8192

DBVERIFY: Release 9.2.0.4.0 - Production on Sun Sep 11 20:13:23 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

DBVERIFY - Verification starting : FILE = users01.dbf

Page 17 is marked corrupt

***

Corrupt block relative dba: 0x00c00011 (file 3, block 17)

Bad check value found during dbv:

Data in bad block -

type: 6 format: 2 rdba: 0x00c00011

last change scn: 0x0000.20a3b575 seq: 0x1 flg: 0x04

consistency value in tail: 0xb5750601

check value in block header: 0x3006, computed block checksum: 0xe803

spare1: 0x0, spare2: 0x0, spare3: 0x0

***

DBVERIFY - Verification complete

Total Pages Examined : 128

Total Pages Processed (Data) : 107

Total Pages Failing (Data) : 0

Total Pages Processed (Index): 0

Total Pages Failing (Index): 0

Total Pages Processed (Other): 20

Total Pages Processed (Seg) : 0

Total Pages Failing (Seg) : 0

Total Pages Empty : 0

Total Pages Marked Corrupt : 1

Total Pages Influx : 0

8.全表扫描此时出现ORA-01578错误

重新启动数据库以后,执行全表扫描,此时错误出现:

SQL> startup force;

ORACLE instance started.

Total System Global Area 101782828 bytes

Fixed Size 451884 bytes

Variable Size 37748736 bytes

Database Buffers 62914560 bytes

Redo Buffers 667648 bytes

Database mounted.

Database opened.

SQL> select count(*) from bbed;

select count(*) from bbed

*

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 3, block # 17)

ORA-01110: data file 3: '/opt/oracle/oradata/conner/users01.dbf'

SQL>

以上方法仅供测试使用。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有