关于10g中的X$KCVFH(续2)

| No Comments

在"关于10g中的X$KCVFH"和"关于10g中的X$KCVFH(续)"这两篇文章里,我介绍了X$KCVFH中各个字段的详细含义,这里我们再进一步来分析一下X$KCVFH的来源。

 

在"关于10g中的X$KCVFH(续)"这篇文章里,我是通过把data file #1X$KCVFH中的记录的内容和data file #1的文件头dump出来的内容做了一个对比从而完善了X$KCVFH中各个字段的含义,这里我们再次定位data file #1

$ bbed parfile=par.txt

Password:

 

BBED: Release 2.0.0.0.0 - Limited Production on Sun May 31 14:23:56 2009

 

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

 

************* !!! For Oracle Internal Use only !!! ***************

 

BBED> set file 1

        FILE#           1

 

BBED> p kcvfh

struct kcvfh, 676 bytes                     @0      

   struct kcvfhbfh, 20 bytes                @0      

      ub1 type_kcbh                         @0        0x0b

      ub1 frmt_kcbh                         @1        0xa2

      ub1 spare1_kcbh                       @2        0x00

      ub1 spare2_kcbh                       @3        0x00

      ub4 rdba_kcbh                         @4        0x00400001

      ub4 bas_kcbh                          @8        0x00000000

      ub2 wrp_kcbh                          @12       0x0000

      ub1 seq_kcbh                          @14       0x01

      ub1 flg_kcbh                          @15       0x04 (KCBHFCKV)

      ub2 chkval_kcbh                       @16       0x339f

      ub2 spare3_kcbh                       @18       0x0000

   struct kcvfhhdr, 76 bytes                @20     

      ub4 kccfhswv                          @20       0x00000000

      ub4 kccfhcvn                          @24       0x0a200100

      ub4 kccfhdbi                          @28       0x5091aeb3

      text kccfhdbn[0]                      @32      I

      text kccfhdbn[1]                      @33      P

      text kccfhdbn[2]                      @34      R

      text kccfhdbn[3]                      @35      A

      text kccfhdbn[4]                      @36      T

      text kccfhdbn[5]                      @37      E

      text kccfhdbn[6]                      @38      S

      text kccfhdbn[7]                      @39      T

      ub4 kccfhcsq                          @40       0x000017b5

      ub4 kccfhfsz                          @44       0x0000f000

      s_blkz kccfhbsz                       @48       0x00

      ub2 kccfhfno                          @52       0x0001

      ub2 kccfhtyp                          @54       0x0003

      ub4 kccfhacid                         @56       0x00000000

      ub4 kccfhcks                          @60       0x00000000

      text kccfhtag[0]                      @64      

      ......省略显示部分内容

      text kccfhtag[31]                     @95      

   ub4 kcvfhrdb                             @96       0x00400179

   struct kcvfhcrs, 8 bytes                 @100    

      ub4 kscnbas                           @100      0x00000008

      ub2 kscnwrp                           @104      0x0000

   ub4 kcvfhcrt                             @108      0x21a23e84

   ub4 kcvfhrlc                             @112      0x28144e35

   struct kcvfhrls, 8 bytes                 @116    

      ub4 kscnbas                           @116      0x00086983

      ub2 kscnwrp                           @120      0x0000

   ub4 kcvfhbti                             @124      0x00000000

   struct kcvfhbsc, 8 bytes                 @128    

      ub4 kscnbas                           @128      0x00000000

      ub2 kscnwrp                           @132      0x0000

   ub2 kcvfhbth                             @136      0x0000

   ub2 kcvfhsta                             @138      0x2004 (KCVFHOFZ)

   struct kcvfhckp, 160 bytes               @484    

      struct kcvcpscn, 8 bytes              @484    

         ub4 kscnbas                        @484      0x1697d667

         ub2 kscnwrp                        @488      0x0009

      ub4 kcvcptim                          @492      0x2904b211

      ub2 kcvcpthr                          @496      0x0001

      union u, 12 bytes                     @500    

         struct kcvcprba, 12 bytes          @500    

            ub4 kcrbaseq                    @500      0x00000049

            ub4 kcrbabno                    @504      0x00065762

            ub2 kcrbabof                    @508      0x0010

      ub1 kcvcpetb[0]                       @512      0x02

      ......省略显示部分内容

      ub1 kcvcpetb[128]                     @640      0x00

   ub4 kcvfhcpc                             @140      0x000000c1

   ub4 kcvfhrts                             @144      0x28144e27

   ub4 kcvfhccc                             @148      0x000000c0

   struct kcvfhbcp, 160 bytes               @152    

      struct kcvcpscn, 8 bytes              @152    

         ub4 kscnbas                        @152      0x00000000

         ub2 kscnwrp                        @156      0x0000

      ub4 kcvcptim                          @160      0x00000000

      ub2 kcvcpthr                          @164      0x0000

      union u, 12 bytes                     @168    

         struct kcvcprba, 12 bytes          @168    

            ub4 kcrbaseq                    @168      0x00000000

            ub4 kcrbabno                    @172      0x00000000

            ub2 kcrbabof                    @176      0x0000

      ub1 kcvcpetb[0]                       @180      0x00

      ......省略显示部分内容

      ub1 kcvcpetb[128]                     @308      0x00

   ub4 kcvfhbhz                             @312      0x00000000

   struct kcvfhxcd, 16 bytes                @316    

      ub4 space_kcvmxcd[0]                  @316      0x00000000

      ub4 space_kcvmxcd[1]                  @320      0x00000000

      ub4 space_kcvmxcd[2]                  @324      0x00000000

      ub4 space_kcvmxcd[3]                  @328      0x00000000

   word kcvfhtsn                            @332      0

   ub2 kcvfhtln                             @336      0x0006

   text kcvfhtnm[0]                         @338     S

   text kcvfhtnm[1]                         @339     Y

   text kcvfhtnm[2]                         @340     S

   text kcvfhtnm[3]                         @341     T

   text kcvfhtnm[4]                         @342     E

   text kcvfhtnm[5]                         @343     M

    ......省略显示部分内容

   text kcvfhtnm[29]                        @367     

   ub4 kcvfhrfn                             @368      0x00000001

   struct kcvfhrfs, 8 bytes                 @372    

      ub4 kscnbas                           @372      0x00000000

      ub2 kscnwrp                           @376      0x0000

   ub4 kcvfhrft                             @380      0x00000000

   struct kcvfhafs, 8 bytes                 @384    

      ub4 kscnbas                           @384      0x00000000

      ub2 kscnwrp                           @388      0x0000

   ub4 kcvfhbbc                             @392      0x00000000

   ub4 kcvfhncb                             @396      0x00000000

   ub4 kcvfhmcb                             @400      0x00000000

   ub4 kcvfhlcb                             @404      0x00000000

   ub4 kcvfhbcs                             @408      0x00000000

   ub2 kcvfhofb                             @412      0x000a

   ub2 kcvfhnfb                             @414      0x000a

   ub4 kcvfhprc                             @416      0x21a23e71

   struct kcvfhprs, 8 bytes                 @420    

      ub4 kscnbas                           @420      0x00000001

      ub2 kscnwrp                           @424      0x0000

   struct kcvfhprfs, 8 bytes                @428    

      ub4 kscnbas                           @428      0x00000000

      ub2 kscnwrp                           @432      0x0000

   ub4 kcvfhtrt                             @444      0x00000000

 

这里我们可以从结果里看到X$KCVFH实际上是来源于kcvfh这个struct

 

有人曾在itpub上问x$kcvfh中的FHRDB是什么意思?其实FHRDB10g里就是代表root dba的意思,Root dba: This field only occurs in data file #1, and is the location of blocks required during bootstrapping the data dictionary (bootstrap$)

 

从上面的结果里我们可以看到现在的root dba0x00400179

SQL> exec sys.cdba('00400179','H');

.

The file is 1

The block is 377

 

PL/SQL procedure successfully completed

 

$ bbed parfile=par.txt

Password:

 

BBED: Release 2.0.0.0.0 - Limited Production on Sun May 31 15:19:56 2009

 

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

 

************* !!! For Oracle Internal Use only !!! ***************

 

BBED> set file 1

        FILE#           1

 

BBED> set block 377

        BLOCK#          377

 

BBED> p ktemh

struct ktemh, 16 bytes                      @92     

   ub4 count_ktemh                          @92       0x00000001

   ub4 next_ktemh                           @96       0x00000000

   ub4 obj_ktemh                            @100      0x00000038

   ub4 flag_ktemh                           @104      0x40000000

 

可以看到这里root dba指向的object实际是0x00000038

SQL> select to_number('38','XX') from dual;

 

TO_NUMBER('38','XX')

--------------------

                  56

 

SQL> select name from sys.obj$ where obj#=56;

 

NAME

------------------------------

BOOTSTRAP$

 

这就是10gX$KCVFH中字段FHRDB的含义

Leave a comment