【BBED】使用bbed 修改日期型別的資料

楊奇龍發表於2011-08-10
日期的儲存格式:
22-FEB-81: 77  b5  02  16  01  01  01 
19-APR-87: 77  bb  04  13  01  01  01 
bbed中把WARD 中的22-FEB-81改為19-APR-87
BBED> x /r
rowdata[443]                                @8064    
------------
flag@8064: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8065: 0x00
cols@8066:    8
col    0[3] @8067:  0xc2  0x4c  0x16 
col    1[4] @8071:  0x57  0x41  0x52  0x44 
col    2[8] @8076:  0x53  0x41  0x4c  0x45  0x53  0x4d  0x41  0x4e 
col    3[3] @8085:  0xc2  0x4d  0x63 
col    4[7] @8089:  0x77  0xb5  0x02  0x16  0x01  0x01  0x01 
col    5[3] @8097:  0xc2  0x0d  0x33 
col    6[2] @8101:  0xc2  0x09 
col    7[2] @8104:  0xc1  0x1f 
設定偏移量到日期欄位的起始位置:
BBED> dump /v offset 8089 count 64
 File: /opt/oracle/oradata/orcl/users01.dbf (4)
 Block: 396     Offsets: 8089 to 8152  Dba:0x0100018c
-------------------------------------------------------
 0777b502 16010101 03c20d33 02c20902 l .w.........3....
 c11f2c00 0803c24b 6405414c 4c454e08 l ..,....Kd.ALLEN.
 53414c45 534d414e 03c24d63 0777b502 l SALESMAN..Mc.w..
 14010101 02c21102 c20402c1 1f2c0008 l .............,..
 <16 bytes per line>
再次偏移:8089+1=8090
BBED> dump /v offset 8090 count 64
 File: /opt/oracle/oradata/orcl/users01.dbf (4)
 Block: 396     Offsets: 8090 to 8153  Dba:0x0100018c
-------------------------------------------------------
 77b50216 01010103 c20d3302 c20902c1 l w.........3.....
 1f2c0008 03c24b64 05414c4c 454e0853 l .,....Kd.ALLEN.S
 414c4553 4d414e03 c24d6307 77b50214 l ALESMAN..Mc.w...
 01010102 c21102c2 0402c11f 2c000803 l ............,...
 <16 bytes per line>
修改日期資料
一次只能修改4個位元組大小以內的,否則報錯。
BBED> modify /x 77bb0413010101
BBED-00209: invalid number (0x786e0602140c1f)
分開修改
BBED> modify /x 77bb0413
 File: /opt/oracle/oradata/orcl/users01.dbf (4)
 Block: 396              Offsets: 8090 to 8153           Dba:0x0100018c
------------------------------------------------------------------------
 77bb0413 01010103 c20d3302 c20902c1 1f2c0008 03c24b64 05414c4c 454e0853 
 414c4553 4d414e03 c24d6307 77b50214 01010102 c21102c2 0402c11f 2c000803 
 <32 bytes per line>
BBED> set offset 8094
        OFFSET          8094
BBED> dump /v offset 8094
 File: /opt/oracle/oradata/orcl/users01.dbf (4)
 Block: 396     Offsets: 8094 to 8157  Dba:0x0100018c
-------------------------------------------------------
 01010103 c20d3302 c20902c1 1f2c0008 l ......3......,..
 03c24b64 05414c4c 454e0853 414c4553 l ..Kd.ALLEN.SALES
 4d414e03 c24d6307 77b50214 01010102 l MAN..Mc.w.......
 c21102c2 0402c11f 2c000803 c24a4605 l ........,....JF.

 <16 bytes per line>
應用校驗和。
BBED> sum dba 4,396 apply
Check value for File 4, Block 396:
current = 0x23cb, required = 0x23cb
BBED> x /rnccntnnn  --檢視,結果已修改
rowdata[443]                                @8064    
------------
flag@8064: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8065: 0x00
cols@8066:    8
col    0[3] @8067: 7521 
col    1[4] @8071: WARD
col    2[8] @8076: SALESMAN
col    3[3] @8085: 7698 
col    4[7] @8089: 19-APR-87 
col    5[3] @8097: 1250 
col    6[2] @8101: 800 
col    7[2] @8104: 30
sqlplus中測試查詢:
SQL> select * from yangobj;
     EMPNO ENAME           JOB               MGR HIREDATE                  SAL       COMM     DEPTNO
---------- --------------- ---------- ---------- ------------------ ---------- ---------- ----------
      7369 SMITH           CLERK            7902 17-DEC-80                 800                    20
      7499 ALLEN           SALESMAN         7698 20-FEB-81                1600        300         30
      7521 WARD            SALESMAN         7698 19-APR-87                1250        800         30

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-704634/,如需轉載,請註明出處,否則將追究法律責任。

相關文章