表空间数据结构研究_01


  1. Space Map Pages (SMPs) hold track of which extents are used and which are free.


  2. Extent Map Pages (EMPs) store the mapping of extents held by that object.


  3. SMP Extent 0 is always the second extent in the tablespace(If the extent size is 32, and therefore SMP Extent 0 starts at Pool Page 32).


  4. Object Table �C stores the extent anchor for the first extent of EMPs, objectID is SQLD_OBJTAB_ID (0xFFFF, 65535).


  5. Extent Map for the Object Table consists of 1 page, always found at the 2nd page of the 1st extent (pool page 1).


  6. DMS: First user object id is 4;  SMS: First user object id is 2.


  7. data page 0 has the same structure: (DMS tablespace).

      .Slot 0:Data Object Header Control Record
      .Slot 1:Free Space Control Record(FSCR)
      .Slot 2:Table Directory Record
      .Slot 3:Table Description Record

Logical address map for a DMS table space:


wKioL1U6EMSwpnnNAAB4iKXhND8753.gif


Pagesize: 8192; Extentsize: 32

TABNAME                          TBSPACEID TABLEID NPAGES              
-------------------------------- --------- ------- --------------------
LOB03                                    3       4                   66
TEST1                                    3       5                    1
LOB01                                    3      33                  975
LOB02                                    3      34                  975


Dump Object Table(objectID:65535)

db2dart sample /dd /tsi 3 /oi 65535 /ps 0 /np 4 /v y

Page 0 ofobject 65535 from table space 3.

         BPS Page Header:

                     Page Data Offset = 48
                     Page Data Length = 8144
                             Page LSN = 00000000697804A2
                   Object Page Number = 0
                     Pool Page Number = 64      --> Extentsize:32, object table 在第3个extent
                            Object ID = 65535
                          Object Type = Data Object

               Data Page Header:

                           Slot Count = 42
                     Total Free Space = 5544
                  Total Reserve Space = 0
               Youngest Reserve Space = n/a
                         Youngest TID = n/a
                    Free Space Offset = 915
                  Maximum Record Size = 152

               Data Records:


            Slot 0:

               Offset Location = 8092  (x1F9C)
               Record Length = 32  (x20)

               Record Type = Data Object Header Control Record

                  Page count = 1
         Object Creation LSN = 0000000001FBAEDA
                Object State = x0000
          UDI Since Runstats = 0
               DFH flag bits = x00000000
        Row Change Timestamp = x00000000000000
                  

            Slot 1:

               Record Type = Free Space Control Record(FSCR)

               Free space entries: --> 500 pages/1 FSCR  (x1FBC: page里没有数据)
                 0:  5848 (x16D8),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                 4:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                 8:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                12:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                16:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                20:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                24:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                28:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                32:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
                ...
               492:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
               496:  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC),  8124 (x1FBC)
               
            ...
            
            Slot 2:

               Offset Location = 7012  (x1B64)
               Record Length = 76  (x4C)

               Record Type = Table Directory Record

                  TDIR version = 2
                  MetaIndex Does Not Exist
                  Max Insert Search = 100
                  Dictionary RID -- Page 0  Slot 0
                  Mapping Directory RID  --  Page 0  Slot 0
                  Current table row format version = 0
                  Flags = x0000000106020000
                     bit representation = 00000000 00000000 00000000 00000001
                                          00000110 00000010 00000000 00000000
                  Check pending info:
                     Constraint status    = x00
                     Constraint RID page      = 0
                     last BID page     = x00000000
                     
            Slot 3:

               Offset Location = 6996  (x1B54)
               Record Length = 16  (x10)

               Record Type = Table Description Record

                  Number of Columns = 1


                  Column 1:
                  Type is Variable Length Character String
                  Maximum Length = 4000
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 0
            
            Slot 4:

               Offset Location = 1068  (x42C)
               Record Length = 152  (x98)

               Record Type = Table Data Record (FIXEDVAR) (PUNC)

               Record Flags = 0

        Object Table record:

                Type: BASE              Version: x00  
                   Pool  ObjID  Extent Anchor      Page 0    Obj State  ObjType    Life LSN

      DATA        3      4           96             0        EXIST   VALID  000000006939855B
      BKM         3      4            0             0    NOT EXIST   VALID  000000006939855B
      INDEX       3      0            0             0    NOT EXIST   VALID  0000000000000000
      XDA         3      0            0             0    NOT EXIST   VALID  0000000000000000
      LONG        3      0            0             0    NOT EXIST   VALID  0000000000000000
      LOB         3      4          160             0        EXIST   VALID  0000000069398CA9
      LOBA        3      4          224             0        EXIST   VALID  0000000069398CA9
       


            Slot 5:

               Offset Location = 916  (x394)
               Record Length = 152  (x98)

               Record Type = Table Data Record (FIXEDVAR) (PUNC)

               Record Flags = 0

        Object Table record:

                Type: BASE              Version: x00  
                   Pool  ObjID  Extent Anchor      Page 0    Obj State  ObjType    Life LSN

      DATA        3      5         1344             0        EXIST   VALID  00000000697801AC
      BKM         3      5            0             0    NOT EXIST   VALID  00000000697801AC
      INDEX       3      0            0             0    NOT EXIST   VALID  0000000000000000
      XDA         3      0            0             0    NOT EXIST   VALID  0000000000000000
      LONG        3      0            0             0    NOT EXIST   VALID  0000000000000000
      LOB         3      0            0             0    NOT EXIST   VALID  0000000000000000
      LOBA        3      0            0             0    NOT EXIST   VALID  0000000000000000
      
                  Slot 6:
               Deleted Record


            Slot 7:
               Deleted Record


            Slot 8:
               Deleted Record
               
            ...
                     
            Slot 33:  --> 和objectID一致


               Record Type = Table Data Record (FIXEDVAR) (PUNC)

        Object Table record:

                Type: BASE              Version: x00  
                   Pool  ObjID  Extent Anchor      Page 0    Obj State  ObjType    Life LSN

      DATA        3     33        21664(EMP first extent) 0        EXIST   VALID  00000000591F63E2
      BKM         3     33            0             0    NOT EXIST   VALID  00000000591F63E2
      INDEX       3      0            0             0    NOT EXIST   VALID  0000000000000000
      XDA         2      0            0             0    NOT EXIST   VALID  0000000000000000
      LONG        2      0            0             0    NOT EXIST   VALID  0000000000000000
      LOB         2     19            0             0        EXIST   VALID  0000000054806C5E
      LOBA        2     19            0             0        EXIST   VALID  0000000054806C5E
       
                   Slot 34:

               Offset Location = 2284  (x8EC)
               Record Length = 152  (x98)

               Record Type = Table Data Record (FIXEDVAR) (PUNC)

               Record Flags = 0

        Object Table record:

                Type: BASE              Version: x00  
                   Pool  ObjID  Extent Anchor      Page 0    Obj State  ObjType    Life LSN

      DATA        3     34        20640             0        EXIST   VALID  000000006884F0A6
      BKM         3     34            0             0    NOT EXIST   VALID  000000006884F0A6
      INDEX       3     34        49440             0        EXIST   VALID  000000006884F0A6
      XDA         3      0            0             0    NOT EXIST   VALID  0000000000000000
      LONG        3      0            0             0    NOT EXIST   VALID  0000000000000000
      LOB         3     34        20704             0        EXIST   VALID  000000006884F0A6
      LOBA        3     34        20768             0        EXIST   VALID  000000006884F0A6

---------------华丽的分割线-------------------------------------------------------

LOB01 Table EMP(ObjectID: 33):

db2dart sample /demp /tsi 3 /oi 33


Object specific mapping info:
   -----------------------------
   DAT extent anchor: 21664
   Traversing extent map for object type: 0
      Tablespace ID: 3, Tablespace Seed: 3, Object: 33 EMP page class: 64,
      EMP pool page: 21664, # entries: 31
      Page LSN = 00000000591F631A
      Pool relative page #'s :
      21696  21728  21760  21792  21824  --> extent first page
      21856  21888  21920  21952  21984
      22016  22048  22080  22112  22144
      22176  22208  22240  22272  22304
      22336  22368  22400  22432  22464
      22496  22528  22560  22592  22624
      22656

      Tablespace ID: 3, Tablespace Seed: 3, Object: 33 EMP page class: 64,
      EMP pool page: 21665, # entries: 0
      Page LSN = 00000000591F4C22
      Pool relative page #'s :
      Tablespace ID: 3, Tablespace Seed: 3, Object: 33 EMP page class: 64,
      EMP pool page: 21666, # entries: 0
      Page LSN = 00000000591F4C22
      Pool relative page #'s :
      ...
      EMP pool page: 21695, # entries: 0
      Page LSN = 00000000591F4C22
      Pool relative page #'s :
      
      21695 - 21664 + 1 = 32 pages(1 extent)
      
      
---------------华丽的分割线-------------------------------------------------------

LOB01 Table:

db2dart sample /dd /tsi 3 /oi 33 /ps 0 /np 4 /v y  


                Page 0 of object 33 from table space 3.

         BPS Page Header:

                     Page Data Offset = 48
                     Page Data Length = 8144
                             Page LSN = 00000000591F4B5E
                   Object Page Number = 0
                     Pool Page Number = 21696  --> 对应EMP 21664 pool page的relative page的第一个extent first page.
                            Object ID = 33
                          Object Type = Data Object

               Data Page Header:

                           Slot Count = 16
                     Total Free Space = 82
                  Total Reserve Space = 0
               Youngest Reserve Space = n/a
                         Youngest TID = n/a
                    Free Space Offset = 113
                  Maximum Record Size = 523

               Data Records:


            Slot 0:

               Offset Location = 8092  (x1F9C)
               Record Length = 32  (x20)

               Record Type = Data Object Header Control Record

                  Page count = 975
         Object Creation LSN = 00000000591F4B5E
                Object State = x0000
          UDI Since Runstats = 0
               DFH flag bits = x00000000
        Row Change Timestamp = x00000000000000
       

            Slot 1:

               Offset Location = 7088  (x1BB0)
               Record Length = 1004  (x3EC)

               Record Type = Free Space Control Record

               Free space entries:
                 0:    82 (x0052),   352 (x0160),   372 (x0174),   331 (x014B)
                 4:   326 (x0146),   345 (x0159),   279 (x0117),    55 (x0037)
                 8:    70 (x0046),   410 (x019A),   151 (x0097),   446 (x01BE)
                12:   512 (x0200),   391 (x0187),   341 (x0155),   331 (x014B)
                16:   313 (x0139),   318 (x013E),   369 (x0171),   313 (x0139)
                20:   273 (x0111),   219 (x00DB),   151 (x0097),   238 (x00EE)
                24:    63 (x003F),   148 (x0094),   116 (x0074),    83 (x0053)
                28:    98 (x0062),    48 (x0030),    93 (x005D),    34 (x0022)
                32:   482 (x01E2),   344 (x0158),   374 (x0176),   339 (x0153)
                36:   330 (x014A),   354 (x0162),   353 (x0161),   353 (x0161)
                40:   323 (x0143),   384 (x0180),   445 (x01BD),   402 (x0192)
                44:   160 (x00A0),    78 (x004E),   130 (x0082),   104 (x0068)
                48:    20 (x0014),    88 (x0058),    43 (x002B),   490 (x01EA)
                52:   330 (x014A),   362 (x016A),   359 (x0167),   345 (x0159)
                56:   317 (x013D),   363 (x016B),   345 (x0159),   344 (x0158)
                60:   386 (x0182),   345 (x0159),   357 (x0165),   357 (x0165)
                64:   338 (x0152),   342 (x0156),   300 (x012C),   478 (x01DE)
                68:   432 (x01B0),    56 (x0038),   342 (x0156),   312 (x0138)
                72:   324 (x0144),   511 (x01FF),   390 (x0186),   351 (x015F)
                76:   341 (x0155),   324 (x0144),   330 (x014A),   283 (x011B)
                80:   278 (x0116),    25 (x0019),    40 (x0028),   118 (x0076)
                84:   261 (x0105),   186 (x00BA),   147 (x0093),    92 (x005C)
                88:   104 (x0068),   116 (x0074),    34 (x0022),    67 (x0043)
                92:   482 (x01E2),   481 (x01E1),   346 (x015A),   366 (x016E)
                96:   330 (x014A),   340 (x0154),   347 (x015B),   346 (x015A)
               100:   363 (x016B),   329 (x0149),   378 (x017A),   401 (x0191)
               104:    41 (x0029),   153 (x0099),    72 (x0048),   123 (x007B)
               108:   104 (x0068),    31 (x001F),    80 (x0050),   472 (x01D8)
               112:   485 (x01E5),   330 (x014A),   378 (x017A),   339 (x0153)
               116:   337 (x0151),   338 (x0152),   375 (x0177),   303 (x012F)
               120:   366 (x016E),   381 (x017D),   342 (x0156),    97 (x0061)
               124:   153 (x0099),    72 (x0048),   123 (x007B),   104 (x0068)
               128:    31 (x001F),    80 (x0050),    69 (x0045),   362 (x016A)
               132:   332 (x014C),   378 (x017A),   352 (x0160),   327 (x0147)
               136:   343 (x0157),   376 (x0178),   306 (x0132),   362 (x016A)
               140:   380 (x017C),   339 (x0153),   370 (x0172),   357 (x0165)
               144:   353 (x0161),   296 (x0128),   334 (x014E),   407 (x0197)
               148:    79 (x004F),   490 (x01EA),   390 (x0186),   150 (x0096)
               152:   349 (x015D),    13 (x000D),   462 (x01CE),   334 (x014E)
               156:   337 (x0151),   311 (x0137),   333 (x014D),   338 (x0152)
               160:   238 (x00EE),   392 (x0188),   130 (x0082),     4 (x0004)
               164:    72 (x0048),   175 (x00AF),   150 (x0096),    68 (x0044)
               168:   135 (x0087),    88 (x0058),    14 (x000E),   103 (x0067)
               172:   460 (x01CC),   352 (x0160),   353 (x0161),   353 (x0161)
               176:   354 (x0162),   300 (x012C),   365 (x016D),   376 (x0178)
               180:   301 (x012D),   378 (x017A),   366 (x016E),    94 (x005E)
               184:    24 (x0018),   127 (x007F),    95 (x005F),   127 (x007F)
               188:    83 (x0053),    27 (x001B),   100 (x0064),   410 (x019A)
               192:   358 (x0166),   336 (x0150),   371 (x0173),   342 (x0156)
               196:   324 (x0144),   358 (x0166),   357 (x0165),   309 (x0135)
               200:   378 (x017A),   373 (x0175),   355 (x0163),   346 (x015A)
               204:   372 (x0174),   337 (x0151),   318 (x013E),   304 (x0130)
               208:   434 (x01B2),    21 (x0015),   496 (x01F0),   436 (x01B4)
               212:    24 (x0018),   178 (x00B2),   350 (x015E),   404 (x0194)
               216:   348 (x015C),   319 (x013F),   338 (x0152),   301 (x012D)
               220:    66 (x0042),    57 (x0039),   407 (x0197),   153 (x0099)
               224:   276 (x0114),   387 (x0183),   182 (x00B6),   132 (x0084)
               228:    76 (x004C),   127 (x007F),    80 (x0050),    25 (x0019)
               232:    91 (x005B),   316 (x013C),   360 (x0168),   363 (x016B)
               236:   334 (x014E),   333 (x014D),   378 (x017A),   346 (x015A)
               240:   360 (x0168),   303 (x012F),   378 (x017A),   356 (x0164)
               244:   369 (x0171),   363 (x016B),   359 (x0167),   351 (x015F)
               248:   343 (x0157),   324 (x0144),   329 (x0149),   291 (x0123)
               252:   110 (x006E),    30 (x001E),   354 (x0162),   240 (x00F0)
               256:   331 (x014B),   509 (x01FD),   459 (x01CB),   343 (x0157)
               260:   326 (x0146),   327 (x0147),   342 (x0156),   259 (x0103)
               264:   285 (x011D),   451 (x01C3),   147 (x0093),   130 (x0082)
               268:   193 (x00C1),   190 (x00BE),   153 (x0099),    85 (x0055)
               272:   110 (x006E),   104 (x0068),    37 (x0025),    79 (x004F)
               276:   512 (x0200),   490 (x01EA),   333 (x014D),   373 (x0175)
               280:   346 (x015A),   310 (x0136),   367 (x016F),   357 (x0165)
               284:   339 (x0153),   340 (x0154),   387 (x0183),   342 (x0156)
               288:    30 (x001E),   156 (x009C),    77 (x004D),   135 (x0087)
               292:   100 (x0064),    17 (x0011),    90 (x005A),     4 (x0004)
               296:   477 (x01DD),   332 (x014C),   385 (x0181),   344 (x0158)
               300:   326 (x0146),   341 (x0155),   382 (x017E),   298 (x012A)
               304:   366 (x016E),   384 (x0180),   348 (x015C),   344 (x0158)
               308:   369 (x0171),   337 (x0151),   339 (x0153),   304 (x0130)
               312:   480 (x01E0),   531 (x0213),   474 (x01DA),   354 (x0162)
               316:   298 (x012A),   253 (x00FD),    63 (x003F),   391 (x0187)
               320:   349 (x015D),   344 (x0158),   326 (x0146),   333 (x014D)
               324:   268 (x010C),   282 (x011A),   502 (x01F6),   140 (x008C)
               328:   600 (x0258),   191 (x00BF),   192 (x00C0),   153 (x0099)
               332:    85 (x0055),   110 (x006E),   104 (x0068),    37 (x0025)
               336:    79 (x004F),   512 (x0200),   490 (x01EA),   343 (x0157)
               340:   364 (x016C),   331 (x014B),   349 (x015D),   339 (x0153)
               344:   366 (x016E),   339 (x0153),   334 (x014E),   379 (x017B)
               348:   351 (x015F),   364 (x016C),   357 (x0165),   336 (x0150)
               352:   320 (x0140),   349 (x015D),   274 (x0112),   172 (x00AC)
               356:   487 (x01E7),   407 (x0197),   191 (x00BF),   327 (x0147)
               360:   516 (x0204),   458 (x01CA),   343 (x0157),   333 (x014D)
               364:   317 (x013D),   318 (x013E),   359 (x0167),   323 (x0143)
               368:   213 (x00D5),   325 (x0145),   149 (x0095),   115 (x0073)
               372:   192 (x00C0),   141 (x008D),   113 (x0071),    89 (x0059)
               376:    95 (x005F),    55 (x0037),    79 (x004F),   512 (x0200)
               380:   482 (x01E2),   344 (x0158),   374 (x0176),   339 (x0153)
               384:   330 (x014A),   354 (x0162),   353 (x0161),   353 (x0161)
               388:   323 (x0143),   384 (x0180),   445 (x01BD),   402 (x0192)
               392:   160 (x00A0),    78 (x004E),   130 (x0082),   104 (x0068)
               396:    20 (x0014),    88 (x0058),    43 (x002B),   490 (x01EA)
               400:   330 (x014A),   362 (x016A),   359 (x0167),   345 (x0159)
               404:   317 (x013D),   363 (x016B),   345 (x0159),   344 (x0158)
               408:   386 (x0182),   345 (x0159),   357 (x0165),   357 (x0165)
               412:   338 (x0152),   342 (x0156),   300 (x012C),   478 (x01DE)
               416:   432 (x01B0),    56 (x0038),   342 (x0156),   312 (x0138)
               420:   324 (x0144),   511 (x01FF),   390 (x0186),   351 (x015F)
               424:   341 (x0155),   324 (x0144),   330 (x014A),   283 (x011B)
               428:   278 (x0116),   493 (x01ED),    96 (x0060),   130 (x0082)
               432:   191 (x00BF),   192 (x00C0),   153 (x0099),    85 (x0055)
               436:   110 (x006E),   104 (x0068),    37 (x0025),    79 (x004F)
               440:     2 (x0002),   481 (x01E1),   346 (x015A),   366 (x016E)
               444:   330 (x014A),   340 (x0154),   347 (x015B),   346 (x015A)
               448:   363 (x016B),   329 (x0149),   378 (x017A),   401 (x0191)
               452:    41 (x0029),   153 (x0099),    72 (x0048),   123 (x007B)
               456:   104 (x0068),    31 (x001F),    80 (x0050),   472 (x01D8)
               460:   485 (x01E5),   330 (x014A),   378 (x017A),   339 (x0153)
               464:   337 (x0151),   338 (x0152),   375 (x0177),   303 (x012F)
               468:   366 (x016E),   381 (x017D),   391 (x0187),    47 (x002F)
               472:   147 (x0093),    87 (x0057),   108 (x006C),    99 (x0063)
               476:    43 (x002B),    80 (x0050),   472 (x01D8),   477 (x01DD)
               480:   332 (x014C),   385 (x0181),   344 (x0158),   324 (x0144)
               484:   347 (x015B),   376 (x0178),   290 (x0122),   373 (x0175)
               488:   389 (x0185),   354 (x0162),   351 (x015F),   359 (x0167)
               492:   337 (x0151),   325 (x0145),   339 (x0153),   390 (x0186)
               496:   123 (x007B),   435 (x01B3),   403 (x0193),   238 (x00EE)
               
            Slot 2:

               Offset Location = 7012  (x1B64)
               Record Length = 76  (x4C)

               Record Type = Table Directory Record

                  TDIR version = 2
                  MetaIndex Does Not Exist
                  Max Insert Search = 0
                  Dictionary RID -- Page 0  Slot 0
                  Mapping Directory RID  --  Page 0  Slot 0
                  Current table row format version = 0
                  Flags = x0000000106000000
                     bit representation = 00000000 00000000 00000000 00000001
                                          00000110 00000000 00000000 00000000
                  Check pending info:
                     Constraint status    = x00
                     Constraint RID page      = 0
                     last BID page     = x00000000

            Slot 3:   --> 表结构

               Offset Location = 6308  (x18A4)
               Record Length = 704  (x2C0)

               Record Type = Table Description Record

                  Number of Columns = 75


                  Column 1:
                  Type is Variable Length Character String
                  Maximum Length = 128
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 0

                  Column 2:
                  Type is Variable Length Character String
                  Maximum Length = 128
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 4

                  Column 3:
                  Type is Fixed Length Character String
                  Length = 1
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 8

                  Column 4:
                  Type is Timestamp
                  Precision = 20
                  Scale = 6
                  Prohibits NULLs
                  Prohibits Default
            ...
            
            Fixed offset: 322

                  Column 74:
                  Type is Fixed Length Character String
                  Length = 1
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 323

                  Column 75:
                  Type is Gregorian Date
                  Length = 4
                  Prohibits NULLs
                  Prohibits Default
            Fixed offset: 324
            
            Slot 4:

               Offset Location = 5788  (x169C)
               Record Length = 520  (x208)

               Record Type = Table Data Record (FIXEDVAR)

               Record Flags = 0

               Fixed part length value = 328

                  Column 1:
            Fixed offset: 0
                  Type is Variable Length Character String
                  Length = 16 Offset = 328
                      5853524F 424A4543 54444554 41494C53    XSROBJECTDETAILS  --> 列值
                        
                  Column 2:
            Fixed offset: 4
                  Type is Variable Length Character String
                  Length = 8 Offset = 344
                      53595343 41542020                      SYSCAT          


                  Column 3:
            Fixed offset: 8
                  Type is Fixed Length Character String
                      56                                     V  
                      
                 ....




你可能感兴趣的:(数据,表空间,结构)