Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

2135

积分

502

好友

184

主题
1#
发表于 2013-11-7 20:51:45 | 查看: 3683| 回复: 4
create table clob_example ( a number, b CLOB )
lob (b) store as ( enable storage in row );
SQL> desc CLOB_EXAMPLE
Name Null? Type
----------------------------------------- -------- ---------------
-------------
A NUMBER
B CLOB
insert into clob_example values ( 1,'abc');
insert into clob_example values ( 2,empty_clob());
SQL> select rowid,a,b from CLOB_EXAMPLE;
ROWID A B
------------------------------------
AAAQYkAAFAAAAA1AAA 1 abc
AAAQYkAAFAAAAA1AAB 2
SQL> select dbms_rowid.rowid_relative_fno('AAAQYkAAFAAAAA1AAA')
from dual;
DBMS_ROWID.ROWID_RELATIVE_FNO('AAAQYKAAFAAAAA1AAA')
---------------------------------------------------
5
SQL> select dbms_rowid.rowid_block_number('AAAQYkAAFAAAAA1AAA')
from dual;
DBMS_ROWID.ROWID_BLOCK_NUMBER('AAAQYKAAFAAAAA1AAA')
---------------------------------------------------
53
alter system dump datafile 5 block 53;











tab 0, row 0, @0x1f72
tl: 46 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 02
col  1: [39]
00 54 00 01 02 0c 00 00 00 01 00 00 00 01 00 00 00 13 db cb 00 13 09 00 00
00 00 00 00 03 00 00 00 00 00 01 61 62 63
LOB
Locator:
  Length:        84(39)
  Version:        1
  Byte Length:    1
  LobID: 00.00.00.01.00.00.00.13.db.cb
  Flags[ 0x02 0x0c 0x00 0x00 ]:
    Type: CLOB
    Storage: BasicFile
    Enable Storage in Row
    Characterset Format: IMPLICIT
    Partitioned Table: No
    Options: ReadWrite
  Inode:
    Size:     19
    Flag:     0x09 [ Valid DataInRow ]
    Future:   0x00 (should be '0x00')
    Blocks:   0
    Bytes:    3
    Version:  00000.0000000001
    Inline data[3]
Dump of memory from 0x00007FC3D2F981F9 to 0x00007FC3D2F981FC
7FC3D2F981F0                   63626101                   [.abc]


tab 0, row 1, @0x1f47
tl: 43 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 2]  c1 03
col  1: [36]
00 54 00 01 02 0c 00 00 00 01 00 00 00 01 00 00 00 13 db cc 00 10 09 00 00
00 00 00 00 00 00 00 00 00 00 00
LOB
Locator:
  Length:        84(36)
  Version:        1
  Byte Length:    1
  LobID: 00.00.00.01.00.00.00.13.db.cc
  Flags[ 0x02 0x0c 0x00 0x00 ]:
    Type: CLOB
    Storage: BasicFile
    Enable Storage in Row
    Characterset Format: IMPLICIT
    Partitioned Table: No
    Options: ReadWrite
  Inode:
    Size:     16
    Flag:     0x09 [ Valid DataInRow ]
    Future:   0x00 (should be '0x00')
    Blocks:   0
    Bytes:    0
    Version:  00000.0000000000
    Inline data[0]












col  1: [39]
00 54 00 01 02 0c 00 00 00 01 00 00 00 01 00 00 00 13 db cb 00 13 09 00 00
00 00 00 00 03 00 00 00 00 00 01 61 62 63


[39]    Length:        84(39)

00 54          len , LOB locator 的最大长度,排除len的这2个字节
00 01          vsn,LOB locator结构的版本  Version:        1
02 0c 00 00      flg 4字节,

  Flags[ 0x02 0x0c 0x00 0x00 ]:
    Type: CLOB
    Storage: BasicFile
    Enable Storage in Row
    Characterset Format: IMPLICIT
    Partitioned Table: No


00 01  bytl = byte length (1 for BLOB/CLOB/BFILE. Value for NCLOB) - 00 01

00 54 00 01 02 0c 00 00 00 01   len(2), vsn(2), flg(4), bytl(2)
00 00 00 01 00 00 00 13 db cb   lob ID     LobID: 00.00.00.01.00.00.00.13.db.cb

00 13 09 00 00 - 00 -size(19)-Flag-(09)-future(00)-blocks(00)-


00 00 00 00 03 00   Bytes (6)

00 00 00 00 01      version 00000.0000000001 (5bytes) inode of 16 bytes
61 62 63 – data.


  Inode:
    Size:     19
    Flag:     0x09 [ Valid DataInRow ]
    Future:   0x00 (should be '0x00')
    Blocks:   0
    Bytes:    3
    Version:  00000.0000000001
    Inline data[3]
下载专业ORACLE数据库恢复工具PRM-DUL  For Oracle http://www.parnassusdata.com/zh-hans/emergency-services

如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!

诗檀软件专业数据库修复团队

服务热线 : 13764045638  QQ: 47079569   
2#
发表于 2013-11-7 21:34:26

CREATE TABLE clob_example2 (x clob);


DECLARE
l_clob clob;
BEGIN
    INSERT INTO clob_example2 (x) VALUES (empty_clob()) --Insert an "empty clob" (not insert null)
    RETURNING x INTO l_clob;

    -- Now we can append content to clob (create a 400,000 bytes clob)
    FOR i IN 1..1000
    LOOP
      dbms_lob.append(l_clob, rpad ('*',4000,'*'));
      --dbms_lob.append(l_clob, 'string chunk to be inserted (maximum 4000 characters at a time)');
    END LOOP;
END;

select length(x) from clob_example2;

alter system checkpoint;
select dbms_rowid.rowid_block_number(rowid),dbms_rowid.rowid_relative_fno(rowid)  from clob_example2;


SQL> alter system dump datafile 1 block 110985;

System altered.



SQL> oradebug setmypid
Statement processed.
SQL>  oradebug tracefile_name
/s01/diag/rdbms/g11r204/G11R204/trace/G11R204_ora_3064.trc

ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1c60   
avsp=0x1f34   
tosp=0x1f34   
0xe:pti[0]      nrow=1  offs=0
0x12:pri[0]     offs=0x1c60
block_row_dump:
tab 0, row 0, @0x1c60
tl: 88 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [84]
00 54 00 01 02 0c 00 00 00 01 00 00 00 01 00 00 00 13 dc 6c 00 40 05 00 00
00 01 eb 1c 14 00 00 00 00 03 e9 00 41 b1 95 00 41 b1 a0 00 41 b1 a3 00 41
b1 a6 00 41 b1 a9 00 41 b1 ac 00 41 b1 af 00 41 b1 b2 00 41 b1 b5 00 41 b1
b8 00 41 b1 bb 00 41 b1 be
LOB
Locator:
  Length:        84(84)
  Version:        1
  Byte Length:    1
  LobID: 00.00.00.01.00.00.00.13.dc.6c
  Flags[ 0x02 0x0c 0x00 0x00 ]:
    Type: CLOB
    Storage: BasicFile
    Enable Storage in Row
    Characterset Format: IMPLICIT
    Partitioned Table: No
    Options: ReadWrite
  Inode:
    Size:     64
    Flag:     0x05 [ Valid InodeInRow(ESIR) ]
    Future:   0x00 (should be '0x00')
    Blocks:   491
    Bytes:    7188
    Version:  00000.0000001001
    DBA Array[12]:
      0x0041b195 0x0041b1a0 0x0041b1a3 0x0041b1a6
      0x0041b1a9 0x0041b1ac 0x0041b1af 0x0041b1b2
      0x0041b1b5 0x0041b1b8 0x0041b1bb 0x0041b1be
          
          
          
0x0041b195  datafile 1 block 110997

SQL> alter system dump datafile 1 block 110997;

System altered.

SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/s01/diag/rdbms/g11r204/G11R204/trace/G11R204_ora_3089.trc

Object Id    93225
LobId: 000100013DC6C PageNo        0
Version: 0x0000.00000003  pdba:        0
2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a

回复 只看该作者 道具 举报

3#
发表于 2013-11-7 22:09:44


CREATE TABLE clob_example2 (x clob);


DECLARE
l_clob clob;
BEGIN
    INSERT INTO clob_example2 (x) VALUES (empty_clob()) --Insert an "empty clob" (not insert null)
    RETURNING x INTO l_clob;

    -- Now we can append content to clob (create a 400,000 bytes clob)
    FOR i IN 1..1000
    LOOP
      dbms_lob.append(l_clob, rpad ('*',4000,'*'));
      --dbms_lob.append(l_clob, 'string chunk to be inserted (maximum 4000 characters at a time)');
    END LOOP;
END;

select length(x) from clob_example2;

alter system checkpoint;
select dbms_rowid.rowid_block_number(rowid),dbms_rowid.rowid_relative_fno(rowid)  from clob_example2;


SQL> alter system dump datafile 1 block 110985;

System altered.



SQL> oradebug setmypid
Statement processed.
SQL>  oradebug tracefile_name
/s01/diag/rdbms/g11r204/G11R204/trace/G11R204_ora_3064.trc

ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1c60   
avsp=0x1f34   
tosp=0x1f34   
0xe:pti[0]      nrow=1  offs=0
0x12:pri[0]     offs=0x1c60
block_row_dump:
tab 0, row 0, @0x1c60
tl: 88 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [84]
00 54 00 01 02 0c 00 00 00 01 00 00 00 01 00 00 00 13 dc 6c 00 40 05 00 00
00 01 eb 1c 14 00 00 00 00 03 e9 00 41 b1 95 00 41 b1 a0 00 41 b1 a3 00 41
b1 a6 00 41 b1 a9 00 41 b1 ac 00 41 b1 af 00 41 b1 b2 00 41 b1 b5 00 41 b1
b8 00 41 b1 bb 00 41 b1 be
LOB
Locator:
  Length:        84(84)
  Version:        1
  Byte Length:    1
  LobID: 00.00.00.01.00.00.00.13.dc.6c
  Flags[ 0x02 0x0c 0x00 0x00 ]:
    Type: CLOB
    Storage: BasicFile
    Enable Storage in Row
    Characterset Format: IMPLICIT
    Partitioned Table: No
    Options: ReadWrite
  Inode:
    Size:     64
    Flag:     0x05 [ Valid InodeInRow(ESIR) ]
    Future:   0x00 (should be '0x00')
    Blocks:   491
    Bytes:    7188
    Version:  00000.0000001001
    DBA Array[12]:
      0x0041b195 0x0041b1a0 0x0041b1a3 0x0041b1a6
      0x0041b1a9 0x0041b1ac 0x0041b1af 0x0041b1b2
      0x0041b1b5 0x0041b1b8 0x0041b1bb 0x0041b1be
          
          
          page ==> 就是 chunk号码 ,pageno 0~pageno~11 是存在行中的, 从12开始要参考LOBINDEX 了
          
          
0x0041b195  datafile 1 block 110997   111038

SQL> alter system dump datafile 1 block 110997;

System altered.

SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/s01/diag/rdbms/g11r204/G11R204/trace/G11R204_ora_3089.trc

Object Id    93225
LobId: 000100013DC6C PageNo        0
Version: 0x0000.00000003  pdba:        0
2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
       
       
       
       
        111038
       
       
        Start dump data blocks tsn: 0 file#:1 minblk 111038 maxblk 111038
Block dump from cache:
Dump of buffer cache at level 4 for tsn=0 rdba=4305342
Block dump from disk:
buffer tsn: 0 rdba: 0x0041b1be (1/111038)
scn: 0x0000.0038be36 seq: 0x02 flg: 0x04 tail: 0xbe361b02
frmt: 0x02 chkval: 0x1e3a type: 0x1b=LOB BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F01B715BA00 to 0x00007F01B715DA00
7F01B715BA00 0000A21B 0041B1BE 0038BE36 04020000  [......A.6.8.....]
7F01B715BA10 00001E3A 00016C29 01000000 13000000  [:...)l..........]
7F01B715BA20 00006CDC 00000019 00000000 0000000B  [.l..............]
7F01B715BA30 00000000 00000000 2A2A2A2A 2A2A2A2A  [........********]
7F01B715BA40 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A  [****************]
        Repeat 506 times
7F01B715D9F0 2A2A2A2A 2A2A2A2A 2A2A2A2A BE361B02  [************..6.]
Long field block dump:
Object Id    93225
LobId: 000100013DC6C PageNo       11
Version: 0x0000.00000019  pdba:        0
2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
    2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
       

回复 只看该作者 道具 举报

4#
发表于 2013-11-8 11:42:15
   Inode:
    Size:     64
    Flag:     0x05 [ Valid InodeInRow(ESIR) ]
    Future:   0x00 (should be '0x00')
    Blocks:   491
    Bytes:    7188
    Version:  00000.0000001001
    DBA Array[12]:
      0x0041b23c 0x0041b246 0x0041b250 0x0041b25a
      0x0041b264 0x0041b26e 0x0041b278 0x0041b802
      0x0041b80c 0x0041b816 0x0041b820 0x0041b82a



回复 只看该作者 道具 举报

5#
发表于 2013-11-8 11:43:32
This is an example blockdump of the LOBINDEX

  create table clob_example ( a number, b CLOB )
                lob (b) store as ( disable storage in row );

where the CLOB is stored OUT OF LINE.

Block header dump: rdba: 0x014000c6
Object id on Block? Y
seg/obj: 0x1242  csc: 0x4d9.771f510e  itc: 2  flg: -  typ: 2 - INDEX
     fsl: 0  fnx: 0x0 ver: 0x01

Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x02   0x0005.00e.000001ef  0x00800456.008a.0b  --U-    1  fsc 0x0000.771f5110

Leaf block dump
===============
header address 17490908=0x10ae3dc
kdxcolev 0
kdxcolok 0
kdxcoopc 0x80: opcode=0: iot flags=--- is converted=Y
kdxconco 2
kdxcosdc 0
kdxconro 2
kdxcofbo 40=0x28
kdxcofeo 1788=0x6fc
kdxcoavs 1748
kdxlespl 0
kdxlende 0
kdxlenxt 0=0x0
kdxleprv 0=0x0
kdxledsz 32
kdxlecol 0
kdxlebksz 1888
row#0[1838] flag: ----, lock: 0, data:(32):
00 20 03 00 00 00 00 00 00 18 00 00 00 00 00 01 01 40 00 be 00 00 00 00 00
00 00 00 00 00 00 00
The index data is the kdlinode for out-of-line
  kdlinode {
    size_kdlinode   size of inline data     =(Oub2) 0x0020 (32)
    flag_kdlinode   is the lob anull lob    =(ub1) 0x03 (3)
        [0x00000001 KDLIDINI   This lob is a valid lob ]
        [0x00000002 KDLIDIDX   the inode is in the index ]
    future_kdlinode  free 1 byte             =(ub1) 0x00 (0)
    blocks_kdlinode  no full oracle blocks   =(kdlpage) 0x00000000 (0)
    bytes_kdlinode  no of bytes in the last page=(k_blk) 0x0018 (24)
    version_kdlinode  version of LOB          =(kdlvn) 0x0001.00000000
  }

  Inline Data is LOB addresses - (NOT LOB DATA): (4 items)
  DBAs of LOB: {
    0x014000be RDBA of LOB page 0
    0x00000000                "       "   1
    0x00000000
    0x00000000}
As 'data' is fixed size then if the LOB needs more than 4 RDBA's additional
index entries indicate the extra DBA's in batches of 8 pages.

col 0;len 10;(10):00 00 00 01 00 00 00 00 75 31
The LobID in the data block is looked up in this index
col 1;len 4;(4):  00 00 00 00
The second part of the key is the page number. Page 0 indicates the
KDLINODE is in the index
row#1[1788] flag: ----, lock: 2, data:(32):
00 20 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00
col 0;len 10;(10):  00 00 00 01 00 00 00 00 75 32
col 1;len 4;(4):  00 00 00 00
----- end of leaf block dump -----

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-6-15 02:23 , Processed in 0.049917 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569