ITPub博客

首页 > 应用开发 > IT综合 > How to Interpret ROWID

How to Interpret ROWID

原创 IT综合 作者:rwq_ 时间:2006-07-29 22:51:41 0 删除 编辑
Oracle ROWID's internal storage is total 10 byte(data_object_id.rdba.nrow), where data_object_id is 4bytes, rdba is 4 bytes and nrow is 2 bytes,and rdba include rfn and blockid,when you use "select rowid from tname" to display the rowid in varchar2 format, oracle do the following convert:[@more@]

SQL> SELECT ROWID FROM TEST.TEST4;

ROWID
------------------
AAABCmAAEAAACxqAAA
AAABCmAAEAAACxqAAB
AAABCmAAEAAACxqAAC
AAABCmAAEAAACxqAAD
AAABCmAAEAAACxqAAE
AAABCmAAEAAACxqAAF
AAABCmAAEAAACxqAAG
AAABCmAAEAAACxqAAH
AAABCmAAEAAACxrAAA

9 rows selected.

SQL> SELECT DATA_OBJECT_ID FROM ALL_OBJECTS WHERE OBJECT_NAME='TEST4';

DATA_OBJECT_ID
--------------
4262

Where each character displayed above is an oracle 64 bit expression as following:

0

1

2

3

4

5

6

7

8

9

0-

A

B

C

D

E

F

G

H

I

J

1-

K

L

M

N

O

P

Q

R

S

T

2-

U

V

W

X

Y

Z

a

b

c

d

3-

e

f

g

h

i

j

k

l

m

n

4-

o

p

q

r

s

t

u

v

w

x

5-

y

z

0

1

2

3

4

5

6

7

6-

8

9

+

/

Then AAABCmAAEAAACxqAAA is splitted as AAABCm.AAE.AAACxq.AAA,

AAABCm = 0,0,0,1,2,38 = 12+2*64+1*64*64=38+128+4096=4262 (data object id)
AAE=0,0,4=4 (relative file number)
AAACxq=0,0,0,2,49,42=2*64*64+49*64+42=8192+3136+42=11370 (block id)
AAA=0,0,0=0 (row index in block)

Accoding to the result calculated above, compare the dump result:

DUL> oradump file 4 block 11370
RDBA=0x01002c6a(4/11370),type=0x06,fmt=0x02,seq=0x02,flag=0x00
seg/obj=0x000010a6=4262,csc=0x0000.001800ca,itc=1,typ=1 - DATA
Transaction Slot:
id xid-usn.slot.wrap uba-rdba.row.seq flag lock fsc/scn
---- ------------------- ------------------ ---- ---- ---------------
0x01 0x0005.05f.0000004d 0x008000cf.0056.2d C--- 0 0x0000.00137db2
Block Data:
hdsz=68
ntab=1
nrow=8
ffre=65535
fsbo=0x0066=102
fseo=0x01f6=502
avsp=0x019e=414
tosp=0x019e=414
tab#= 0 nrow= 8 offs= 0
row#= 0 offs=0x01b2= 434+ 68=0x01f6= 502 flag=--H-FL--
row#= 1 offs=0x05a3= 1443+ 68=0x05e7= 1511 flag=--H-FL--
row#= 2 offs=0x0994= 2452+ 68=0x09d8= 2520 flag=--H-FL--
row#= 3 offs=0x0d85= 3461+ 68=0x0dc9= 3529 flag=--H-FL--
row#= 4 offs=0x1176= 4470+ 68=0x11ba= 4538 flag=--H-FL--
row#= 5 offs=0x1567= 5479+ 68=0x15ab= 5547 flag=--H-FL--
row#= 6 offs=0x1958= 6488+ 68=0x199c= 6556 flag=--H-FL--
row#= 7 offs=0x1d49= 7497+ 68=0x1d8d= 7565 flag=--H-FL--

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

请登录后发表评论 登录
全部评论
  • 博文量
    36
  • 访问量
    637355