ITPub博客

首页 > 数据库 > Oracle > oracle数据的存储形式

oracle数据的存储形式

原创 Oracle 作者:wanghao2979 时间:2017-01-12 13:28:09 0 删除 编辑
查看表结构
SQL> desc dba_objects
Name           Type          Nullable Default Comments                                                                     
-------------- ------------- -------- ------- ---------------------------------------------------------------------------- 
OWNER          VARCHAR2(30)  Y                Username of the owner of the object                                          
OBJECT_NAME    VARCHAR2(128) Y                Name of the object                                                           
SUBOBJECT_NAME VARCHAR2(30)  Y                Name of the sub-object (for example, partititon)                             
OBJECT_ID      NUMBER        Y                Object number of the object                                                  
DATA_OBJECT_ID NUMBER        Y                Object number of the segment which contains the object                       
OBJECT_TYPE    VARCHAR2(19)  Y                Type of the object                                                           
CREATED        DATE          Y                Timestamp for the creation of the object                                     
LAST_DDL_TIME  DATE          Y                Timestamp for the last DDL change (including GRANT and REVOKE) to the object 
TIMESTAMP      VARCHAR2(19)  Y                Timestamp for the specification of the object                                
STATUS         VARCHAR2(7)   Y                Status of the object                                                         
TEMPORARY      VARCHAR2(1)   Y                Can the current session only see data that it place in this object itself?   
GENERATED      VARCHAR2(1)   Y                Was the name of this object system generated?                                
SECONDARY      VARCHAR2(1)   Y                Is this a secondary object created as part of icreate for domain indexes?    
NAMESPACE      NUMBER        Y                Namespace for the object                                                     
EDITION_NAME   VARCHAR2(30)  Y                Name of the edition in which the object is actual                

创建测试表
create table system.test as select * from dba_objects



查看表数据
select * from system.test where object_id = 39

1 SYS I_OBJ4 39 39 INDEX 2011/9/17 9:46:13 2011/9/17 9:46:13 2011-09-17:09:46:13 VALID N N N 4



定位 system.test object_id =39 的数据块
begin
exec get_block('system','test','object_id=39');
end
/
2299059 5


将数据块 dump 出来

tab 0, row 33, @0x14fe
tl: 78 fb: --H-FL-- lb: 0x0  cc: 14
col  0: [ 3]  53 59 53
col  1: [ 6]  49 5f 4f 42 4a 34
col  2: *NULL*
col  3: [ 2]  c1 28
col  4: [ 2]  c1 28
col  5: [ 5]  49 4e 44 45 58
col  6: [ 7]  78 6f 09 11 0a 2f 0e
col  7: [ 7]  78 6f 09 11 0a 2f 0e
col  8: [19]  32 30 31 31 2d 30 39 2d 31 37 3a 30 39 3a 34 36 3a 31 33
col  9: [ 5]  56 41 4c 49 44
col 10: [ 1]  4e
col 11: [ 1]  4e
col 12: [ 1]  4e
col 13: [ 2]  c1 05

可以看到  col  1: [ 6]  49 5f 4f 42 4a 34  这一行,应该对应的是object_name 

我们查询一下表数据,进行一下验证
begin
exec get_dump('system','test','OBJECT_NAME','object_id=39');
end
/

 I_OBJ4 Typ=1 Len=6: 73,95,79,66,74,52 Typ=1 Len=6: 49,5f,4f,42,4a,34


我们再看一下 LAST_DDL_TIME 的内容, col  7: [ 7]  78 6f 09 11 0a 2f 0e
begin
exec get_dump('system','test','LAST_DDL_TIME','object_id=39');
end
/


 I_OBJ4 Typ=12 Len=7: 120,111,9,17,10,47,14 Typ=12 Len=7: 78,6f,9,11,a,2f,e



根据DSI说法 char internal code :96, varchar2 Internal code: 1,NUMBER Internal code: 2,LONG Internal code: 8,DATE Internal code: 12...


我们再从逆向进行一下验证

col  1: [ 6]  49 5f 4f 42 4a 34  
根据上面记录进行一下查询

begin
exec get_charrowvalue('495f4f424a34','c');
end
/

I_OBJ4
PL/SQL procedure successfully completed

col  7: [ 7]  78 6f 09 11 0a 2f 0e
根据上面记录进行一下查询
begin
exec get_daterowvalue('786f09110a2f0e','d');
end
/

 
2011-09-17 09:46:13
 
PL/SQL procedure successfully completed

得到了正确数值



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

请登录后发表评论 登录
全部评论
主要负责客户现场exadata与exalogic设备的维护工作, 擅长于ORACLE数据库环境/高可用环境的搭建及故障诊断, 并且也获有 11g ocp 证书,10g ocm 证书

注册时间:2017-01-10

  • 博文量
    90
  • 访问量
    84716