四、使用BBED修改日期类型的数据
日期的存储格式:
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: 0×00
cols@8066: 8
col 0[3] @8067: 0xc2 0x4c 0×16
col 1[4] @8071: 0×57 0×41 0×52 0×44
col 2[8] @8076: 0×53 0×41 0x4c 0×45 0×53 0x4d 0×41 0x4e
col 3[3] @8085: 0xc2 0x4d 0×63
col 4[7] @8089: 0×77 0xb5 0×02 0×16 0×01 0×01 0×01
col 5[3] @8097: 0xc2 0x0d 0×33
col 6[2] @8101: 0xc2 0×09
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: 0×00
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

Trackback

no comment untill now

Add your comment now

切换到手机版