Professional Documents
Culture Documents
Ora BBED 4
Ora BBED 4
备注:
DBA = 0x00400001 ====> 0000 0000 0100 0000 0000 0000 0000 0001
从以上所知的前 10 位为 file#,所以可以放一个分隔符再看:
0000 0000 01[分隔符]00 0000 0000 0000 0000 0001 (4194305 1,1)
可以看出 file#=1,block#=1 ,就和上面的 show 出来的信息对应起来了
set 命令 --设置相应的信息
如果要查看 2 号文件的 2 号块,则可以使用 set 命令来设置文件号和块号
BBED> set file 2
FILE# 2
BBED> set block 2
BLOCK# 2
DBA = 0x00800002 ===》 0000 0000 1000 0000 0000 0000 0000 0010
再次回到 1 号文件的 0 号块
BBED> set file 1
FILE# 1
备注:
从 Offsets 可以看出,只显示了 0-511 个字节的偏移,也就是 512 个字节的信息,因为默认
是 COUNT=512。我们知道 oracle 一个块默认大小 8192,所以如果要让一个块的 dump 信息
显示完全的话,就可以 set count 8192,再执行 dump
从 8183 开始显示这个字段信息
我们就 dump 这一点:
BBED> dump /v dba 7,132 offset 8183
File: /u01/app/oracle/oradata/oracle01/test101.dbf (7)
Block: 132 Offsets: 8183 to 8191 Dba:0x01c00084
-------------------------------------------------------
41414141 41010665 2c l AAAAA..e,
<16 bytes per line>
这个就是数据字段了
更改数据字段
BBED> modify /c ABCED dba 7,132 offset 8183
File: /u01/app/oracle/oradata/oracle01/test101.dbf (7)
Block: 132 Offsets: 8183 to 8191 Dba:0x01c00084
------------------------------------------------------------------------
41424345 44010665 2c
<32 bytes per line>
保存数据
BBED> sum dba 7,132 apply
Check value for File 7, Block 132:
current = 0xc875, required = 0xc875
1.得到文件的块大小和数据块个数
在 Linux 和 Unix 上,oracle 提供了一个小工具 dbfsize 用于查看文件块大小
(参看[ID:360032.1]How to detect and fix a corruption in the datafile OS header - ORA-27047)
BBED> dump
File: /u01/app/oracle/oradata/test1212/system01.dbf (1)
Block: 0 Offsets: 0 to 511 Dba:0x00400000
-----------------------------------------------------------------------
00a20000 0000c0ff 00000000 00000000 67ae0000 00200000 00540100 7d7c7b7a
a0810000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Oracle 给我们提供了一个字典表来查询系统是大端还是小端:
SQL> select * from V$TRANSPORTABLE_PLATFORM ORDER BY PLATFORM_ID;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- -------------------------------------------------- ----------------------------
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
3 HP-UX (64-bit) Big
4 HP-UX IA (64-bit) Big
5 HP Tru64 UNIX Little
6 AIX-Based Systems (64-bit) Big
7 Microsoft Windows IA (32-bit) Little
8 Microsoft Windows IA (64-bit) Little
9 IBM zSeries Based Linux Big
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
12 Microsoft Windows x86 64-bit Little
13 Linux x86 64-bit Little
15 HP Open VMS Little
16 Apple Mac OS Big
17 Solaris Operating System (x86) Little
18 IBM Power Based Linux Big
19 HP IA Open VMS Little
20 Solaris Operating System (x86-64) Little
21 Apple Mac OS (x86-64) Little
有了上面的补充知识,那么回过来看“00200000”和“00540100”。因为我机器的环境是
linux 64 位,所以是小端,所以在存储的时候其实是取反了再存的。
00540100 取反==》00015400
select to_number('15400','xxxxxx') from dual; 87040
备注:
BBED> dump
File: /u01/app/oracle/oradata/test1212/system01.dbf (1)
Block: 1 Offsets: 0 to 511 Dba:0x00400001
------------------------------------------------------------------------
0ba20000 01004000 00000000 00000104 fae40000 00000000 0000200b 021aedcf
54455354 31323132 30050000 00540100 00200000 01000300 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
08024000 07000000 00000000 25316a29 04864d31 38830b00 00000000 00000000
00000000 00000000 00000420 97000000 25f6ff31 96000000 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 06005359 5354454d 00000000 00000000
00000000 00000000 00000000 00000000 01000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 0a000a00
20316a29 01000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 7b281100 000093bf fd660132 0100775b 39000000 02000000 10005d10
这下更能清楚的看到:
ub4 kccfhdbi @28 0xcfed1a02
text kccfhdbn[0] @32 T
text kccfhdbn[1] @33 E
text kccfhdbn[2] @34 S
text kccfhdbn[3] @35 T
text kccfhdbn[4] @36 1
text kccfhdbn[5] @37 2
text kccfhdbn[6] @38 1
text kccfhdbn[7] @39 2