BBED可以直接查看/编辑数据块内容,对于了解数据块结构、在特殊情况下恢复数据特别有用,功能非常强大。
1,编译:
[oracle@rhel5 lib]$ uname -a
Linux rhel5 2.6.18-8.el5xen #1 SMP Thu Mar 15 21:02:53 EDT 2007 i686 i686 i386 GNU/Linux
[oracle@rhel5 lib]$ id
uid=503(oracle) gid=502(oinstall) groups=502(oinstall),503(dba)
[oracle@rhel5 lib]$ cd $ORACLE_HOME/rdbms/lib
[oracle@rhel5 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
Linking BBED utility (bbed)
rm -f /oracle/10g/rdbms/lib/bbed
gcc -o /oracle/10g/rdbms/lib/bbed -L/oracle/10g/rdbms/lib/ -L/oracle/10g/lib/ -L/oracle/10g/lib/stubs/ -L/usr/lib -lirc /oracle/10g/lib/s0main.o /oracle/10g/rdbms/lib/ssbbded.o /oracle/10g/rdbms/lib/sbbdpt.o `cat /oracle/10g/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 /oracle/10g/rdbms/lib/defopt.o -ldbtools10 -lclntsh `cat /oracle/10g/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /oracle/10g/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /oracle/10g/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /oracle/10g/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /oracle/10g/lib/sysliblist` -Wl,-rpath,/oracle/10g/lib -lm `cat /oracle/10g/lib/sysliblist` -ldl -lm -L/oracle/10g/lib
./bbed
[oracle@rhel5 lib]$ ./bbed
Password: [blockedit]
BBED: Release 2.0.0.0.0 - Limited Production on Sun Mar 16 15:40:18 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
:
N - a number which specifies a repeat count.
u - a letter which specifies a unit size:
b - b1, ub1 (byte)
h - b2, ub2 (half-word)
w - b4, ub4(word)
r - Oracle table/index row
f - a letter which specifies a display format:
x - hexadecimal
d - decimal
u - unsigned decimal
o - octal
c - character (native)
n - Oracle number
t - Oracle date
i - Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] =
: [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
: [ value | ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]
2,修改数据
2.1创建测试表
create tablespace bbed_tbs
datafile '/oracle/oradata/ora10ctg/bbed_tbs01.dbf'
size 10M autoextend on
extent management local uniform. size 1M
segment space management auto;
create table bbed_tbl tablespace bbed_tbs
as
select rownum id,rpad('abc',1000,' ') txt from dual
connect by level<20;
SELECT id,
substr(txt,1,10) txt,
dbms_rowid.rowid_relative_fno(ROWID) fno,
dbms_rowid.rowid_block_number(ROWID) bno
FROM bbed_tbl;
ID TXT FNO BNO
---------- --------------- ---------- ----------
1 abc 12 13
2 abc 12 13
3 abc 12 13
4 abc 12 13
5 abc 12 13
6 abc 12 13
7 abc 12 13
8 abc 12 14
9 abc 12 14
10 abc 12 14
11 abc 12 14
12 abc 12 14
13 abc 12 14
14 abc 12 14
15 abc 12 15
16 abc 12 15
17 abc 12 15
18 abc 12 15
19 abc 12 15
19 rows selected
SQL> select file_id,file_name,bytes from dba_data_files where file_id=12;
FILE_ID FILE_NAME BYTES
---------- -------------------------------------------- ----------
12 /oracle/oradata/ora10ctg/bbed_tbs01.dbf 10485760
2.2 修改数据
[oracle@rhel5 mah]$ cat filelist.txt
1 /oracle/oradata/ora10ctg/bbed_tbs01.dbf 10485760
==>必须从1开始编号,后续使用文件编号时,需要使用这里指定的1
[oracle@rhel5 lib]$ ./bbed
BBED> set list '/home/oracle/mah/filelist.txt'
LISTFILE /home/oracle/mah/filelist.txt
BBED> set dba 12,13
BBED-00310: no datafile specified
BBED> set dba 1,13
DBA 0x0040000d (4194317 1,13)
BBED> p ktbbh
...事务信息
BBED> p kdbr ==>块内行
sb2 kdbr[0] @142 7055
sb2 kdbr[1] @144 6046
sb2 kdbr[2] @146 5037
sb2 kdbr[3] @148 4028
sb2 kdbr[4] @150 3019
sb2 kdbr[5] @152 2010
sb2 kdbr[6] @154 1001
BBED> p *kdbr[3] ==>第4行数据
rowdata[3027]
-------------
ub1 rowdata[3027] @4152 0x2c
说明:
* 4152=4028+块头大小(124=20+24+8+24*3)
* 块头大小124=20+24+8+24*3,包括cache layer + fix_trans + var_trans + 8
BBED> x /r ==>e(x)amine row
rowdata[3027] @4152
-------------
flag@4152: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4153: 0x00
cols@4154: 2
col 0[2] @4155: 0xc1 0x05 ==>id=4
col 1[1000] @4158: 0x61 0x62 0x63 0x20 0x20 0x20 0x20 0x20 0x20 0x20
0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20
...
0x20 0x20
BBED> x /rnc ==>e(x)amine rnc=row + number + char
rowdata[3027] @4152
-------------
flag@4152: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4153: 0x00
cols@4154: 2
col 0[2] @4155: 4
col 1[1000] @4158: abc ==>此处abc开始位置为4161,4158-4160字节表示该列长度
*如果重复数据少,可以使用 find /c abc查找位置
确认目标字符串位置:
BBED> dump /v dba 1,13 offset 4161 count 64
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 13 Offsets: 4161 to 4224 Dba:0x0040000d
-------------------------------------------------------
61626320 20202020 20202020 20202020 l abc
20202020 20202020 20202020 20202020 l
20202020 20202020 20202020 20202020 l
20202020 20202020 20202020 20202020 l
<16 bytes per line>
BBED> modify /x b2e2cad4 dba 1,13 offset 4161
BBED-00215: editing not allowed in BROWSE mode
BBED> set mode edit
MODE Edit
BBED> modify /x b2e2cad4 dba 1,13 offset 4161 ==>?
BBED-00209: invalid number (b2e2cad4)
BBED> modify /c "测试" dba 1,13 offset 4161
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 13 Offsets: 4161 to 4224 Dba:0x0040000d
------------------------------------------------------------------------
b2e2cad4 20202020 20202020 20202020 20202020 20202020 20202020 20202020
20202020 20202020 20202020 20202020 20202020 20202020 20202020 20202020
在SQLPLUS窗口:
SQL> alter system flush buffer_cache;
System altered.
SQL> select id,substr(txt,1,20) from bbed_tbl;
select id,substr(txt,1,20) from bbed_tbl
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 12, block # 13)
ORA-01110: data file 12: '/oracle/oradata/ora10ctg/bbed_tbs01.dbf'
回到bbed窗口:
BBED> sum dba 1,13
Check value for File 1, Block 13:
current = 0x306b, required = 0x4a1f
BBED> sum dba 1,13 apply
Check value for File 1, Block 13:
current = 0x4a1f, required = 0x4a1f
在SQLPLUS窗口:
SQL> alter system flush buffer_cache;
System altered.
SQL> select id,substr(txt,1,20) from bbed_tbl;
ID SUBSTR(TXT,1,20)
---------- ----------------------------------------
1 abc
2 abc
3 abc
4 测试
5 abc
6 abc
7 abc
8 abc
9 abc
10 abc
11 abc
12 abc
13 abc
14 abc
15 abc
16 abc
17 abc
18 abc
19 abc
19 rows selected.
SQL> select platform_name,endian_format from v$transportable_platform. where platform_name like 'Linux%';
PLATFORM_NAME ENDIAN_FORMAT
------------------------- --------------
Linux IA (32-bit) Little
Linux IA (64-bit) Little
Linux 64-bit for AMD Little
说明:由于该平台是Little ENDIAN FORMAT,字节序需要反转。
SQL> alter system dump datafile 12 block 13;
System altered.
该数据块的dump文件,参见附录.
3,移花接木替换数据
SELECT id,
substr(txt,1,10) txt,
dbms_rowid.rowid_relative_fno(ROWID) fno,
dbms_rowid.rowid_block_number(ROWID) bno
FROM bbed_tbl;
ID TXT FNO BNO
---------- -------------------- ---------- ----------
1 abc 12 13
2 abc 12 13
3 abc 12 13
4 测试 12 13
5 abc 12 13
6 abc 12 13
7 abc 12 13
8 abc 12 14
9 abc 12 14
10 abc 12 14
11 abc 12 14
12 abc 12 14
13 abc 12 14
14 abc 12 14
15 abc 12 15 *被替换的
16 abc 12 15 *被替换的
17 abc 12 15 *被替换的
18 abc 12 15 *被替换的
19 abc 12 15 *被替换的
19 rows selected
下面通过替换数据块(12,15)插入新数据.
3.1创建新的块
create table bbed_tbl2 tablespace bbed_tbs
as
select * from bbed_tbl where 1=2;
insert into bbed_tbl2
select 1000+rownum id,rpad('abc-new',1000,' ') txt from dual
connect by level<10;
SELECT id,
substr(txt,1,10) txt,
dbms_rowid.rowid_relative_fno(ROWID) fno,
dbms_rowid.rowid_block_number(ROWID) bno
FROM bbed_tbl2;
SQL> SELECT id,
2 substr(txt,1,10) txt,
3 dbms_rowid.rowid_relative_fno(ROWID) fno,
4 dbms_rowid.rowid_block_number(ROWID) bno
5 FROM bbed_tbl2;
ID TXT FNO BNO
---------- -------------------- ---------- ----------
1001 abc-new 12 161 *替换进来的
1002 abc-new 12 161 *替换进来的
1003 abc-new 12 161 *替换进来的
1004 abc-new 12 161 *替换进来的
1005 abc-new 12 161 *替换进来的
1006 abc-new 12 161 *替换进来的
1007 abc-new 12 161 *替换进来的
1008 abc-new 12 165
1009 abc-new 12 165
在SQLPLUS窗口:
SQL> alter system checkpoint;
System altered.
确保数据已写入文件.
3.2 用新块替换旧块(表bbed_tbl2的块161=>表bbed_tbl的块15)
在操作系统窗口:
[oracle@rhel5 udump]$ dd if=/oracle/oradata/ora10ctg/bbed_tbs01.dbf f=tmp.dbf bs=8192 skip=161 count=1
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000128 seconds, 64.0 MB/s
[oracle@rhel5 udump]$ dd if=tmp.dbf f=/oracle/oradata/ora10ctg/bbed_tbs01.dbf bs=8192 seek=15 count=1 conv=notrunc
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000106 seconds, 77.3 MB/s
3.3 需要修改新块内的RDBA和object_id,最后sum apply即可
3.3.1确认数据块内为新数据
在BBED窗口:
BBED> set dba 1,15
DBA 0x0040000f (4194319 1,15)
BBED> dump
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 15 Offsets: 4 to 67 Dba:0x0040000f
------------------------------------------------------------------------
a1000003 1717c512 00000204 66110000 01000000 f4f60000 1717c512 00000000
02003200 89000003 02002500 800e0000 1c008000 de210600 07000000 00000000
<32 bytes per line>
BBED> p *kdbr[3]
rowdata[3030]
-------------
ub1 rowdata[3030] @4148 0x2c
BBED>
BBED> x /rnc
rowdata[3030] @4148
-------------
flag@4148: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4149: 0x01
cols@4150: 2
col 0[3] @4151: 1004 ==>已经是替换过来的数据
col 1[1000] @4155: abc-new
3.3.2 修改RDBA
BBED> set mode edit
MODE Edit
BBED> dump /v dba 1,15 offset 4 count 64
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 15 Offsets: 4 to 67 Dba:0x0040000f
-------------------------------------------------------
a1000003 1717c512 00000204 66110000 l ............f...
01000000 f4f60000 1717c512 00000000 l ................
02003200 89000003 02002500 800e0000 l ..2.......%.....
1c008000 de210600 07000000 00000000 l .....!..........
<16 bytes per line>
说明:
(1)Dba:0x0040000f是(1,15)对应dba,并不是真实dba
SQL> SELECT to_char(dbms_utility.make_data_block_address(1, 15), 'xxxxxxx')
2 FROM dual;
TO_CHAR(DBMS_UTILITY.MAKE_DATA
------------------------------
40000f
(2)块中的rdba对应该数据块原来所处位置:
SQL> select to_number('030000a1','xxxxxxxx') from dual;
TO_NUMBER('030000A1','XXXXXXXX
------------------------------
50331809
SQL> SELECT dbms_utility.data_block_address_file(50331809),
2 dbms_utility.data_block_address_block(50331809)
3 FROM dual;
DBMS_UTILITY.DATA_BLOCK_ADDRES DBMS_UTILITY.DATA_BLOCK_ADDRES
------------------------------ ------------------------------
12 161
(3)RDBA需要修改为:
SQL> SELECT to_char(dbms_utility.make_data_block_address(12, 15), 'xxxxxxx')
2 FROM dual;
TO_CHAR(DBMS_UTILITY.MAKE_DATA
------------------------------
300000f
==>rdba=0f000003
3.3.3 修改object_id
BBED> modify /x 0f000003 dba 1,15 offset 4
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 15 Offsets: 4 to 67 Dba:0x0040000f
------------------------------------------------------------------------
0f000003 1717c512 00000204 66110000 01000000 f4f60000 1717c512 00000000
02003200 89000003 02002500 800e0000 1c008000 de210600 07000000 00000000
<32 bytes per line>
BBED> dump /v dba 1,15 offset 24 count 64
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 15 Offsets: 24 to 87 Dba:0x0040000f
-------------------------------------------------------
f4f60000 1717c512 00000000 02003200 l ..............2.
89000003 02002500 800e0000 1c008000 l ......%.........
de210600 07000000 00000000 00000000 l .!..............
00000000 00000000 00000000 00000000 l ................
<16 bytes per line>
说明:
f4f60000为原来块所属对象id,需要修改为f2f60000
select object_name,to_char(data_object_id,'XXXXXXXX') oid
from dba_objects
where wner=user and object_name in('BBED_TBL','BBED_TBL2');
OBJECT_NAME OID
-------------- ------------------------------
BBED_TBL F6F2
BBED_TBL2 F6F4
BBED> modify /x f2f60000 dba 1,15 offset 24
BBED-00209: invalid number (f2f60000)
BBED> modify /x f2f6 dba 1,15 offset 24
File: /oracle/oradata/ora10ctg/bbed_tbs01.dbf (1)
Block: 15 Offsets: 24 to 39 Dba:0x0040000f
------------------------------------------------------------------------
f2f60000 1717c512 00000000 02003200
<32 bytes per line>
3.3.4 计算校验和
BBED> sum apply
Check value for File 1, Block 15:
current = 0x11ce, required = 0x11ce
3.4 SQL验证
在SQLPLUS窗口:
SQL> SELECT id,
2 substr(txt,1,10) txt,
3 dbms_rowid.rowid_relative_fno(ROWID) fno,
4 dbms_rowid.rowid_block_number(ROWID) bno
5 FROM bbed_tbl;
ID TXT FNO BNO
---------- -------------------- ---------- ----------
1 abc 12 13
2 abc 12 13
3 abc 12 13
4 测试 12 13
5 abc 12 13
6 abc 12 13
7 abc 12 13
8 abc 12 14
9 abc 12 14
10 abc 12 14
11 abc 12 14
12 abc 12 14
13 abc 12 14
14 abc 12 14
15 abc 12 15
16 abc 12 15
17 abc 12 15
18 abc 12 15
19 abc 12 15
19 rows selected
SQL> alter system flush buffer_cache;
System altered
SQL>
SQL> SELECT id,
2 substr(txt,1,10) txt,
3 dbms_rowid.rowid_relative_fno(ROWID) fno,
4 dbms_rowid.rowid_block_number(ROWID) bno
5 FROM bbed_tbl;
ID TXT FNO BNO
---------- -------------------- ---------- ----------
1 abc 12 13
2 abc 12 13
3 abc 12 13
4 测试 12 13
5 abc 12 13
6 abc 12 13
7 abc 12 13
8 abc 12 14
9 abc 12 14
10 abc 12 14
11 abc 12 14
12 abc 12 14
13 abc 12 14
14 abc 12 14
1001 abc-new 12 15 *替换进来的
1002 abc-new 12 15 *替换进来的
1003 abc-new 12 15 *替换进来的
1004 abc-new 12 15 *替换进来的
1005 abc-new 12 15 *替换进来的
1006 abc-new 12 15 *替换进来的
1007 abc-new 12 15 *替换进来的
21 rows selected
---------------------
附录,数据块dump文件:
Start dump data blocks tsn: 10 file#: 12 minblk 13 maxblk 13
buffer tsn: 10 rdba: 0x0300000d (12/13) ==>buffer tsn: 10,dump时查询获得,原始block中没有该信息
scn: 0x0000.12c2e305 seq: 0x02 flg: 0x04 tail: 0xe3050602 ==>tail=SCNBase+type+seq
frmt: 0x02 chkval: 0x4a1f type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x0E5AA400 to 0x0E5AC400
E5AA400 0000A206 0300000D 12C2E305 04020000 [................] ==>06:type A2.AND.x0F=x02:format 0300000D:RDBA 12C2E305:SCNBase 0000:SCNWrap 02:Seq 04:flag
E5AA410 00004A1F 00000001 0000F6F2 12C2E304 [.J..............] ==>4A1F:checkval(db_block_checksum=true时校验) 01:ktbbhtyp 0000F6F2:ktbbhsid(seg/obj) 12C2E304:ktbbhcsc.kscnbas(The SCN at which the last full cleanout was performed on the block )
E5AA420 00000000 00320003 03000009 0000FFFF [......2.........] ==>03:ktbbhict 32:ktbbhflg 03000009:ktbbhfnx
E5AA430 00000000 00000000 00000000 00008000 [................]
E5AA440 12C2E304 00000000 00000000 00000000 [................] ==>12C2E304:ktbitbas
E5AA450 00000000 00000000 00000000 00000000 [................]
Repeat 1 times
E5AA470 00000000 00000000 00000000 00070100 [................]
E5AA480 0020FFFF 03C903E9 000003C9 1B8F0007 [.. .............]
E5AA490 13AD179E 0BCB0FBC 03E907DA 00000000 [................]
E5AA4A0 00000000 00000000 00000000 00000000 [................]
Repeat 59 times
E5AA860 00000000 02002C00 FE08C102 626103E8 [.....,........ab]
E5AA870 20202063 20202020 20202020 20202020 [c ]
E5AA880 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AAC50 20202020 002C2020 07C10202 6103E8FE [ ,........a]
E5AAC60 20206362 20202020 20202020 20202020 [bc ]
E5AAC70 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AB040 20202020 2C202020 C1020200 03E8FE06 [ ,........]
E5AB050 20636261 20202020 20202020 20202020 [abc ]
E5AB060 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AB430 20202020 20202020 0202002C E8FE05C1 [ ,.......]
E5AB440 CAE2B203 202020D4 20202020 20202020 [..... ]
E5AB450 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AB820 20202020 20202020 02002C20 FE04C102 [ ,......]
E5AB830 626103E8 20202063 20202020 20202020 [..abc ]
E5AB840 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5ABC10 20202020 20202020 002C2020 03C10202 [ ,.....]
E5ABC20 6103E8FE 20206362 20202020 20202020 [...abc ]
E5ABC30 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AC000 20202020 20202020 2C202020 C1020200 [ ,....]
E5AC010 03E8FE02 20636261 20202020 20202020 [....abc ]
E5AC020 20202020 20202020 20202020 20202020 [ ]
Repeat 60 times
E5AC3F0 20202020 20202020 20202020 E3050602 [ ....] ==>E3050602:tail,首尾验证
Block header dump: 0x0300000d
Object id on Block? Y
seg/obj: 0xf6f2 csc: 0x00.12c2e304 itc: 3 flg: E typ: 1 - DATA
brn: 0 bdba: 0x3000009 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0xffff.000.00000000 0x00000000.0000.00 C--- 0 scn 0x0000.12c2e304
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x03 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
data_block_dump,data header at 0xe5aa47c
===============
tsiz: 0x1f80
hsiz: 0x20
pbl: 0x0e5aa47c
bdba: 0x0300000d
76543210
flag=--------
ntab=1
nrow=7
frre=-1
fsbo=0x20
fseo=0x3e9
avsp=0x3c9
tosp=0x3c9
0xe:pti[0] nrow=7 offs=0
0x12:pri[0] offs=0x1b8f
0x14:pri[1] offs=0x179e
0x16:pri[2] offs=0x13ad
0x18:pri[3] offs=0xfbc
0x1a:pri[4] offs=0xbcb
0x1c:pri[5] offs=0x7da
0x1e:pri[6] offs=0x3e9
block_row_dump:
tab 0, row 0, @0x1b8f
tl: 1009 fb: --H-FL-- lb: 0x0 cc: 2
col 0: [ 2] c1 02
col 1: [1000]
61 62 63 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
...
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
tab 0, row 1, @0x179e
tab 0, row 2, @0x13ad
tab 0, row 3, @0xfbc
tl: 1009 fb: --H-FL-- lb: 0x0 cc: 2
col 0: [ 2] c1 05
col 1: [1000]
b2 e2 ca d4 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
...
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
tab 0, row 4, @0xbcb
tab 0, row 5, @0x7da
tab 0, row 6, @0x3e9
tl: 1009 fb: --H-FL-- lb: 0x0 cc: 2
col 0: [ 2] c1 08
col 1: [1000]
61 62 63 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
...
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
end_of_block_dump
End dump data blocks tsn: 10 file#: 12 minblk 13 maxblk 13
说明,block内seq的取值
A sequence number incremented for each change to a block at the same SCN
A new SCN is allocated if the sequence number wraps.
同一个SCN 影响这个block 中的行数大于 254 行就会为这个事务分配一个新的SCN
如下面的操作就可能引起同一个SCN 但影响的同一个block 中的行超过254 行
"delete from table_name"
影响的行数( 最大254) 是用从 0x01 到 0xfe 表示的
当这个byte 的数据为 0xff 的时候标志这个 block 坏调了---> ora-01578
Sequence number:
SEQ -> 0 /* non-logged changes - do not advance seq# */
SEQ -> (UB1MAXVAL-1)/* maximum possible sequence number */
SEQ -> (UB1MAXVAL) /* seq# to indicate a block is corrupt,equal to FF. soft corrupt */
0xff : When present it indicates that the block has been marked as corrupt by Oracle. either by the db_block_checking functionality or the equivalent events (10210 for data blocks, 10211 for index blocks, and 10212 for cluster blocks) when making a database change, or by the DBMS_REPAIR.FIX_CORRUPT_BLOCKS procedure, or by PMON after an unsuccessful online block recovery attempt while recovering a failed process, or by RMAN during a BACKUP, COPY or VALIDATE command with the CHECK LOGICAL option. Logical corruptions are normally due to either recovery through a NOLOGGING operation, or an Oracle software bug. )
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/18922393/viewspace-713376/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/18922393/viewspace-713376/