ITPub博客

首页 > 数据库 > Oracle > [20210920]bbed的assign命令.txt

[20210920]bbed的assign命令.txt

原创 Oracle 作者:lfree 时间:2021-09-24 10:51:10 0 删除 编辑

[20210920]bbed的assign命令.txt

--//在windows下使用bbed的assign,发现没有linux下遇到的问题,做一个记录。

D:\tools\bbed>ver
Microsoft Windows XP [版本 5.1.2600]

BBED> info all
 File#  Name                     Size(blks)
 -----  ----                     ----------
     7  d:\tools\bbed\tea01.dbf           0

BBED> set dba 7,140
        DBA             0x01c0008c (29360268 7,140)
    
BBED> x /rnccntnnn dba 7,140 *kdbr[0]
rowdata[529]                                @8150
------------
flag@8150: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8151: 0x00
cols@8152:    8

col    0[3] @8153: 7369
col    1[5] @8157: SMITH
col    2[5] @8163: CLERK
col    3[3] @8169: 7902
col    4[7] @8173: 1980-12-17 00:00:00
col    5[2] @8181: 800
col    6[0] @8184: *NULL*
col    7[2] @8185: 20

BBED> p dba 7,140 kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x15055972

BBED> assign 8=0xf5055972
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 bas_kcbh                                @8        0xf5055972
--//第1位大于0x8.

BBED> p dba 7,140 kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0xf5055972
--//可以发现windows下的bbed使用assign没有任何问题,难道当时在linux测试有什么细节我没有注意吗?
--//重复在linux下的测试如下:

SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table empx as select * from emp;
Table created.

SCOTT@book> select rowid from empx where rownum=1;
ROWID
------------------
AAAW4gAAEAAAAmjAAA

SCOTT@book> @ rowid AAAW4gAAEAAAAmjAAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
     93728          4       2467          0  0x10009A3           4,2467               alter system dump datafile 4 block 2467

SCOTT@book> alter system checkpoint ;
System altered.

--//使用bbed修改:
BBED> set dba 4,2467
        DBA             0x010009a3 (16779683 4,2467)

BBED> p /x dba 4,2467  kcbh.wrp_kcbh
ub2 wrp_kcbh                                @12       0x0003

BBED> p /x dba 4,2467  kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x7fa46d5f

BBED> assign 12=2;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub2 wrp_kcbh                                @12       0x0002

BBED> p /x dba 4,2467  kcbh.wrp_kcbh
ub2 wrp_kcbh                                @12       0x0002

BBED> assign 8=0x8fa46d5f
BBED-00207: invalid offset specifier (8fa46d5f)

BBED> assign 8=0x6fa46d5f
ub4 bas_kcbh                                @8        0x6fa46d5f

--//可以发现修改第1位是大于0x8,就出现问题.提示BBED-00207.换另外的方式:
BBED> assign kcbh.bas_kcbh=0x7fa46d5f
ub4 bas_kcbh                                @8        0x7fa46d5f

BBED> assign kcbh.bas_kcbh=0x8fa46d5f
BBED-00207: invalid offset specifier (8fa46d5f)

--//同样报错.
--//0x8fa46d5f = 2409917791

BBED> assign kcbh.bas_kcbh=2409917791
BBED-00207: invalid offset specifier (2409917791)


BBED> assign kcbh.bas_kcbh=409917791
ub4 bas_kcbh                                @8        0x186ed95f

BBED> assign kcbh.bas_kcbh=0x87146111
BBED-00206: out of range offset (87146111)

BBED> assign kcbh.bas_kcbh=0x8714611a
BBED-00207: invalid offset specifier (8714611a)

--//还可以发现一个奇怪的现象,如果16进制全部数字不包括a-f,提示是BBED-00206.不是BBED-00207.

BBED> assign kcbh.bas_kcbh=0x7fa46d5f
ub4 bas_kcbh                                @8        0x7fa46d5f

BBED> assign 8=0x7fa46d5f
ub4 bas_kcbh                                @8        0x7fa46d5f

--//只要第一位不是0x8,两种方式都可以正常执行.很明显这个是bbed的bug.
BBED> assign kcbh.bas_kcbh=-1
BBED-00217: unable to assign: (-1) is out of range (0, 4294967295)

BBED> assign 8=-1
BBED-00217: unable to assign: (-1) is out of range (0, 4294967295)

--//最大值可以是4294967295,4294967295 = 0xffffffff,很明显前面的值没有操作这个范围.

BBED> assign 8=4294967295
BBED-00207: invalid offset specifier (4294967295)


BBED> assign  kcbh.bas_kcbh=4294967295
BBED-00207: invalid offset specifier (4294967295)

BBED> assign  kcbh.bas_kcbh=0x7fffffff
ub4 bas_kcbh                                @8        0x7fffffff

BBED> assign  8=0x7ffffffe
ub4 bas_kcbh                                @8        0x7ffffffe

--//看来是bug确定无疑,如果出现这种情况,修改只能使用modify,而modify必须考虑大小头问题,这样就比较麻烦了.
--//比如要修改为0x8fa46d5f,颠倒过来就是 5f6da48f.

BBED>  modify /x 5f6da48f offset 8
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 2467     Offsets:    8 to   11    Dba:0x010009a3
--------------------------------
 5f6da48f

 <128 bytes per line>

BBED> p /x dba 4,2467  kcbh.wrp_kcbh
ub2 wrp_kcbh                                @12       0x0002

BBED> p /x dba 4,2467  kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x8fa46d5f

--//modify也有1个缺点.比如修改为0x8fa46d8f,颠倒过来就是 8f6da48f.

BBED>  modify /x 8f6da48f offset 8
BBED-00209: invalid number (8f6da48f)

--//如果4位修改第一位也是不能大于0x8,不然也报错,必须分开修改,

BBED> modify /x 8f6d offset 8
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 2467    Offsets:    8 to   11    Dba:0x010009a3
--------------------------------
 8f6da48f

 <128 bytes per line>

BBED> modify /x a48f offset 10
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 2467     Offsets:   10 to   13   Dba:0x010009a3
--------------------------------
 a48f0200

 <128 bytes per line>

BBED> p /x dba 4,2467  kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x8fa46d8f

--//或者这样修改:
BBED> modify /x 8f6da4 offset 8
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 2467      Offsets:    8 to   11     Dba:0x010009a3
--------------------------------
 8f6da48f

 <128 bytes per line>

BBED> modify /x 8f offset 11
 File: /mnt/ramdisk/book/users01.dbf (4)
 Block: 2467       Offsets:   11 to   14    Dba:0x010009a3
--------------------------------
 8f020002
<128 bytes per line>

BBED> p /x dba 4,2467  kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x8fa46d8f

--//总之如果真正遇到这样的情况处理起来在linux下相对麻烦.
--//收尾还原;

BBED> assign  8=0x7fa46d5f
ub4 bas_kcbh                                @8        0x7fa46d5f

BBED> assign  12=2
ub2 wrp_kcbh                                @12       0x0002

BBED> sum
Check value for File 4, Block 2467:
current = 0xfb68, required = 0xfb69
--//嗯,检查和不对.噢改错了.
BBED> assign  12=3
ub2 wrp_kcbh                                @12       0x0003

BBED> sum
Check value for File 4, Block 2467:
current = 0xfb68, required = 0xfb68

--//OK没有问题.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2793449/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    3031
  • 访问量
    6775249