[20150728]关于block record flag2.txt

[20150728]关于block record flag2.txt

--昨天被别人问及这个block record flag,google找到如下链接:
http://www.hcdba.com/?p=18
--做一个记录。

#define KDRHFK 0x80 Cluster Key
#define KDRHFC 0x40 Clustered table member
#define KDRHFH 0x20 Head piece of row
#define KDRHFD 0x10 Deleted row
#define KDRHFF 0x08 First data piece
#define KDRHFL 0x04 Last data piece
#define KDRHFP 0x02 First column continues from Previous piece
#define KDRHFN 0x01 Last column continues in Next piece
---------------------------------------------------
AC====>0x80+0x20+0x08+0x04 ===>dump中的(K-H-FL--)
6C====>0x40+0x20+0x08+0x04 ===>dump中的(-CH-FL--)
2C====>0x20+0x08+0x04      ===>dump中的(--H-FL--)
3C====>0x20+0x10+0x08+0x04 ===>dump中的(--HDFL--)

--为了加强记忆,通过一些例子讲解这8个bit。
--还剩下2个
#define KDRHFK 0x80 Cluster Key
#define KDRHFC 0x40 Clustered table member
--应该与cluster有关

1.建立测试例子:

SCOTT@test> @ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

--关于cluser 可以参考:
http://blog.itpub.net/267265/viewspace-1266411/
http://blog.itpub.net/267265/viewspace-1276613/

create cluster cluster_dept (deptno NUMBER(2)) ;
create index i_cluster_deptno on cluster cluster_dept;

create table dept1 cluster cluster_dept(deptno) as select * from dept;
create table emp1  cluster cluster_dept(deptno) as select * from emp;

SCOTT@test> select owner,object_name,object_id,data_object_id,object_type  from dba_objects where owner=user and object_name in ('DEPT1','EMP1','CLUSTER_DEPT');
OWNER  OBJECT_NAME           OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------ -------------------- ---------- -------------- -------------------
SCOTT  CLUSTER_DEPT             291016         291016 CLUSTER
SCOTT  DEPT1                    291018         291016 TABLE
SCOTT  EMP1                     291019         291016 TABLE
--可以发现这些对象的DATA_OBJECT_ID=291016.

SCOTT@test> select owner,segment_name,segment_type,header_file,header_block,bytes  from dba_segments where owner=user and segment_name in ('DEPT1','EMP1','CLUSTER_DEPT','I_CLUSTER_DEPTNO');
OWNER  SEGMENT_NAME         SEGMENT_TYPE       HEADER_FILE HEADER_BLOCK      BYTES
------ -------------------- ------------------ ----------- ------------ ----------
SCOTT  I_CLUSTER_DEPTNO     INDEX                        4         1986      65536
SCOTT  CLUSTER_DEPT         CLUSTER                      4         1978     131072

--注意1些细节,仅仅存在CLUSTER_DEPT,I_CLUSTER_DEPTNO段.

2.继续测试:
SCOTT@test> select rowid,dept1.* from dept1;
ROWID                  DEPTNO DNAME          LOC
------------------ ---------- -------------- -------------
AABHDIAAEAAAAe7AAA         20 RESEARCH       DALLAS1
AABHDIAAEAAAAe8AAA         30 SALES          CHICAGO
AABHDIAAEAAAAe9AAA         40 OPERATIONS     BOSTON
AABHDIAAEAAAAe+AAA         50 aaa            bbb
AABHDIAAEAAAAe/AAA         10 ACCOUNTING     NEW YORK
AABHDIAAEAAAAIgAAA         70 aaaa           BBBB
AABHDIAAEAAAAInAAA         60 cc             AAA
7 rows selected.

SCOTT@test> @ lookup_rowid AABHDIAAEAAAAe7AAA
    OBJECT       FILE      BLOCK        ROW DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
    291016          4       1979          0 4,1979               alter system dump datafile 4 block 1979
 
--bbed观察:
BBED> set  dba 4,1979
        DBA             0x010007bb (16779195 4,1979)

BBED> p *kdbr[0]
rowdata[202]
------------
ub1 rowdata[202]                            @8166     0xac

BBED> x /rccn
rowdata[202]                                @8166
------------
flag@8166: 0xac (KDRHFL, KDRHFF, KDRHFH, KDRHFK)
lock@8167: 0x00
cols@8168:    1
kref@8169:    6
mref@8171:    6
hrid@8173:0x010007bb.0
nrid@8179:0x010007bb.0
col    0[2] @8185: ..

--flag =0xac,很奇怪col显示不正常!

SCOTT@test> @dfb16 0x010007bb
    RFILE#     BLOCK# TEXT
---------- ---------- ------------------------------------------------------------
         4       1979 alter system dump datafile 4 block 1979 ;

SCOTT@test> alter system dump datafile 4 block 1979 ;
System altered.

--查看转储:
Block header dump:  0x010007bb
Object id on Block? Y
seg/obj: 0x470c8  csc: 0x02.a63f479c  itc: 2  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x10007b8 ver: 0x01 opc: 0
     inc: 0  exflg: 0

Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0001.00a.000044bd  0x00c005b5.1c5b.0f  C---    0  scn 0x0002.a63f4789
0x02   0x0005.008.0000725e  0x00c007a0.2518.1a  --U-    5  fsc 0x0000.a63f47a3
bdba: 0x010007bb
data_block_dump,data header at 0x2a974de264
===============
tsiz: 0x1f98
hsiz: 0x28
pbl: 0x2a974de264
     76543210
flag=--------
ntab=3
-- 从这里看出有3个表。
nrow=7
frre=-1
fsbo=0x28
fseo=0x1eb8
avsp=0x1e90
tosp=0x1e90
0xe:pti[0]  nrow=1  offs=0
0x12:pti[1] nrow=1  offs=1
0x16:pti[2] nrow=5  offs=2
0x1a:pri[0] offs=0x1f82
0x1c:pri[1] offs=0x1f6d
0x1e:pri[2] offs=0x1f4a
0x20:pri[3] offs=0x1f24
0x22:pri[4] offs=0x1eff
0x24:pri[5] offs=0x1edc
0x26:pri[6] offs=0x1eb8
block_row_dump:
tab 0, row 0, @0x1f82
tl: 22 fb: K-H-FL-- lb: 0x0  cc: 1
curc: 6 comc: 6 pk: 0x010007bb.0 nk: 0x010007bb.0
col  0: [ 2]  c1 15                                 => 对应数字20.
--flag=fb: K-H-FL--, 对应0xac
--组合起来:
#define KDRHFK 0x80 Cluster Key
#define KDRHFH 0x20 Head piece of row
#define KDRHFF 0x08 First data piece
#define KDRHFL 0x04 Last data piece
---------------------------------------
tab 1, row 0, @0x1f6d
tl: 21 fb: -CH-FL-- lb: 0x0  cc: 2 cki: 0
col  0: [ 8]  52 45 53 45 41 52 43 48
col  1: [ 7]  44 41 4c 4c 41 53 31
-------------------------------------
SCOTT@test> @conv_c 5245534541524348
C60
------------------------------------------------------------
RESEARCH
SCOTT@test> @conv_c 44414c4c415331
C60
------------------------------------------------------------
DALLAS1

SCOTT@test> select * from dept1 where deptno=20;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        20 RESEARCH       DALLAS1
--可以发现是对上的。

--表1dept1,flag=fb: -CH-FL--,对应0x6c.
--组合起来:
#define KDRHFC 0x40 Clustered table member
#define KDRHFH 0x20 Head piece of row
#define KDRHFF 0x08 First data piece
#define KDRHFL 0x04 Last data piece
-----------------------------------------------------------------------
tab 2, row 0, @0x1f4a
tl: 35 fb: -CH-FL-- lb: 0x2  cc: 6 cki: 0
col  0: [ 3]  c2 4a 46
col  1: [ 5]  53 4d 49 54 48
col  2: [ 5]  43 4c 45 52 4b
col  3: [ 3]  c2 50 03
col  4: [ 7]  77 b4 0c 11 01 01 01
col  5: [ 2]  c2 09

SCOTT@test> @conv_n c24a46
       N20
----------
      7369

SCOTT@test> select * from emp1 where empno=7369;
     EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 1980-12-17 00:00:00        800                    20

--转换都是对上的。

总结:

--总结:
#define KDRHFK 0x80 Cluster Key                                    =>使用K表示
#define KDRHFC 0x40 Clustered table member                         =>使用C表示
#define KDRHFH 0x20 Head piece of row                              =>使用H表示
#define KDRHFD 0x10 Deleted row                                    =>使用D表示
#define KDRHFF 0x08 First data piece                               =>使用F表示
#define KDRHFL 0x04 Last data piece                                =>使用L表示
#define KDRHFP 0x02 First column continues from Previous piece     =>使用P表示
#define KDRHFN 0x01 Last column continues in Next piece            =>使用N表示

时间: 2024-10-14 07:30:47

[20150728]关于block record flag2.txt的相关文章

[20150728]关于block record flag1.txt

[20150728]关于block record flag1.txt --昨天被别人问及这个block record flag,google找到如下链接: http://www.hcdba.com/?p=18 --做一个记录. #define KDRHFK 0x80 Cluster Key #define KDRHFC 0x40 Clustered table member #define KDRHFH 0x20 Head piece of row #define KDRHFD 0x10 Del

[20150228]Delayed Block Cleanout 2.txt

[20150228]Delayed Block Cleanout 2.txt --前几天我自己做了1次Delayed Block Cleanout的例子,我一直有一个疑问. --链接如下:http://blog.itpub.net/267265/viewspace-1441526/ --如果我很久不查询这些块,scn会是多少呢?这个一直是我的疑问,重复测试: 1.建立测试环境: SCOTT@test> @ver1 PORT_STRING                    VERSION   

[20130904]等待事件wait for a undo record模拟.txt

[20130904]等待事件wait for a undo record模拟.txt 模拟等待事件wait for a undo record. 1.测试环境: SCOTT@test> @ver BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bi

[20150929]11g关于行链接.txt

[20150929]11g关于行链接.txt --曾经写过block record flag: http://blog.itpub.net/267265/viewspace-1753924/ http://blog.itpub.net/267265/viewspace-1753933/ --总结如下: #define KDRHFK 0x80 Cluster Key                                    =>使用K表示 #define KDRHFC 0x40 Clu

[20161111File Space Bitmap Block修复机制

[20161111]File Space Bitmap Block修复机制.txt --前几天在测试File Space Bitmap Block时执行了,execute dbms_space_admin.TABLESPACE_REBUILD_BITMAPS('SUGAR') --这样位图区全部设置为1,显示都是F.它的修复机制不是非常清楚,今天做一些深入的探究. --继续重复昨天的测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING            

[0424]11GR2 Automatic block media repair

[20140424]11GR2 Automatic block media repair.txt 摘要:PacktPub.Oracle.Data.Guard.11gR2.Administration.Beginners.Guide.Jun.2013.pdf P388 In Oracle 11gR2, when Actve Data Guard is being used with Real-Time Apply, if a physical corrupton is detected on th

[20130226]跟踪特定IP的sql语句.txt

[20130226]跟踪特定IP的sql语句.txt 工作需要,跟踪特定IP地址发出的sql语句.可惜我们生产系统是10g的,如果是11G支持trcsess可以合并trc文件,再分析.自己做一个测试看看. http://space.itpub.net/267265/viewspace-754003 1.建立logon触发器: CREATE OR REPLACE TRIGGER SYS.on_logon_trigger    AFTER LOGON ON DATABASE DECLARE    v

javaweb-extjs调用百度地图初始化失败,要二次加载

问题描述 extjs调用百度地图初始化失败,要二次加载 extjs代码 /* * 报警事项处理窗口 * yening 2015.2.7 * * paras.winTitle:窗口显示的标题 * paras.width:窗口宽度 * paras.height: * */ Ext.ns('Ext.ux.window'); Ext.ux.window.AlarmProcessWnd = function(paras) { var me = this; var xflwdwUrl = "./xflwdw

win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory

今天想在在win7 64位环境下使用python 操作mysql 在安装MySQL-python 时报错:   _mysql.c _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No s uch file or directory     error: command '"C:\Users\fnngj\AppData\Local\Programs\Common\Microsoft\Visual