【Oracle ASM】Variable Extent Size 原理

Variable size extents enable support for larger ASM datafiles, reduce SGA memory requirements for very large databases, and improve performance for file create and open operations. The size of the extent map that defines a file can be smaller by a factor of 8 and 64 depending on the file size. The initial extent size is equal to the allocation unit size and it increases by a factor of 8 and 64 at predefined thresholds. This feature is automatic for newly created and resized datafiles when the disk group compatibility attributes are set to Oracle Release 11 or higher. For information about compatibility attributes, see “Disk Group Compatibility”.

For 11.1 shows the ASM file extent relationship with allocation units. Extent size is always equal to AU for the first 20000 extent sets (0 – 19999). Figure 1-4 shows the first eight extents (0 to 7) distributed on four ASM disks. After the first 20000 extent sets, the extent size becomes 8*AU for next 20000 extent sets (20000 – 39999). This is shown as bold rectangles labeled with the extent set numbers 20000 to 20007, and so on. The next increment for an ASM extent is 64*AU (not shown in the figure).

The ASM coarse striping is always equal to the disk group AU size, but fine striping size always remains 128KB in any configuration (not shown in the figure). The AU size is determined at creation time with the allocation unit size (AU_SIZE) disk group attribute. The values can be 1, 2, 4, 8, 16, 32, and 64 MB.

 

 

FOR 11.2:

The extent size of a file varies as follows:

  • Extent size always equals the disk group AU size for the first 20000 extent sets (0 – 19999).
  • Extent size equals 4*AU size for the next 20000 extent sets (20000 – 39999).
  • Extent size equals 16*AU size for the next 20000 and higher extent sets (40000+)

 

 

 

ostmg004

 

如绿字所标记 Variable Extent Size要求DATABASE_COMPATIBILITY 》=11.1,否则不管你构建多大的数据文件 最后其Extent Size总是等于1个AU的。

 

SQL> select * from x$kffxp where size_kffxp!=1 and rownum<3;

ADDR                   INDX    INST_ID GROUP_KFFXP NUMBER_KFFXP COMPOUND_KFFXP INCARN_KFFXP  PXN_KFFXP XNUM_KFFXP  LXN_KFFXP DISK_KFFXP   AU_KFFXP FLAGS_KFFXP  CHK_KFFXP SIZE_KFFXP
---------------- ---------- ---------- ----------- ------------ -------------- ------------ ---------- ---------- ---------- ---------- ---------- ----------- ---------- ----------
00007F6FCB2557F0      54983          1           1         6345       16783561    838455287      40000      20000          0          4      17036           0        224          4
00007F6FCB2557F0      54984          1           1         6345       16783561    838455287      40001      20000          1          0       3888           0         21          4

 

如上述查询 size_kffxp 为Extent的大小(几个AU)。 这些EXTENT对应于FILE NUMBER 6345:

 

 

[oracle@mlab2 ~]$ kfed read /dev/asm-disk9 aun=22 blkn=201|less
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            4 ; 0x002: KFBTYP_FILEDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                    6345 ; 0x004: blk=6345
kfbh.block.obj:                       1 ; 0x008: file=1
kfbh.check:                  2648198861 ; 0x00c: 0x9dd84ecd
kfbh.fcn.base:                  1506490 ; 0x010: 0x0016fcba
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfffdb.node.incarn:           838455287 ; 0x000: A=1 NUMM=0x18fce7fb
kfffdb.node.frlist.number:   4294967295 ; 0x004: 0xffffffff
kfffdb.node.frlist.incarn:            0 ; 0x008: A=0 NUMM=0x0
kfffdb.hibytes:                       5 ; 0x00c: 0x00000005
kfffdb.lobytes:              1073750016 ; 0x010: 0x40002000
kfffdb.xtntcnt:                   40768 ; 0x014: 0x00009f40
kfffdb.xtnteof:                   40768 ; 0x018: 0x00009f40
kfffdb.blkSize:                    8192 ; 0x01c: 0x00002000
kfffdb.flags:                        17 ; 0x020: O=1 S=0 S=0 D=0 C=1 I=0 R=0 A=0
kfffdb.fileType:                      2 ; 0x021: 0x02
kfffdb.dXrs:                         18 ; 0x022: SCHE=0x1 NUMB=0x2
kfffdb.iXrs:                         19 ; 0x023: SCHE=0x1 NUMB=0x3
kfffdb.dXsiz[0]:                  20000 ; 0x024: 0x00004e20
kfffdb.dXsiz[1]:                  20000 ; 0x028: 0x00004e20
kfffdb.dXsiz[2]:             4294967288 ; 0x02c: 0xfffffff8
kfffdb.iXsiz[0]:             4294967295 ; 0x030: 0xffffffff
kfffdb.iXsiz[1]:                      0 ; 0x034: 0x00000000
kfffdb.iXsiz[2]:                      0 ; 0x038: 0x00000000
kfffdb.xtntblk:                      63 ; 0x03c: 0x003f
kfffdb.break:                        60 ; 0x03e: 0x003c
kfffdb.priZn:                         0 ; 0x040: KFDZN_COLD
kfffdb.secZn:                         0 ; 0x041: KFDZN_COLD
kfffdb.ub2spare:                      0 ; 0x042: 0x0000
kfffdb.alias[0]:                   6998 ; 0x044: 0x00001b56
kfffdb.alias[1]:             4294967295 ; 0x048: 0xffffffff
kfffdb.strpwdth:                      8 ; 0x04c: 0x08
kfffdb.strpsz:                       20 ; 0x04d: 0x14
kfffdb.usmsz:                         0 ; 0x04e: 0x0000
kfffdb.crets.hi:               32999496 ; 0x050: HOUR=0x8 DAYS=0x2 MNTH=0x2 YEAR=0x7de
kfffdb.crets.lo:              988212224 ; 0x054: USEC=0x0 MSEC=0x1bb SECS=0x2e MINS=0xe
kfffdb.modts.hi:               32999500 ; 0x058: HOUR=0xc DAYS=0x2 MNTH=0x2 YEAR=0x7de
kfffdb.modts.lo:                      0 ; 0x05c: USEC=0x0 MSEC=0x0 SECS=0x0 MINS=0x0
kfffdb.dasz[0]:                       0 ; 0x060: 0x00
kfffdb.dasz[1]:                       2 ; 0x061: 0x02
kfffdb.dasz[2]:                       4 ; 0x062: 0x04
kfffdb.dasz[3]:                       0 ; 0x063: 0x00
kfffdb.permissn:                      0 ; 0x064: 0x00
kfffdb.ub1spar1:                      0 ; 0x065: 0x00
kfffdb.ub2spar2:                      0 ; 0x066: 0x0000
kfffdb.user.entnum:                   0 ; 0x068: 0x0000
kfffdb.user.entinc:                   0 ; 0x06a: 0x0000
kfffdb.group.entnum:                  0 ; 0x06c: 0x0000
kfffdb.group.entinc:                  0 ; 0x06e: 0x0000

/* -------------------------------- kfdasz --------------------------------- */
/*
  NAME
    kfdasz - Kernel Files Disk Au SiZe.

  DESCRIPTION
    Enumerates the possible AU size multiples which may be used for
    Multi-AU "buddied" extents.

  NOTES
    The AU size multiple value may be determined by using the
    KFDASZ_VALUE macro.
*/
#ifndef KFDASZ_1X
/* 10g had space for four sizes, but only 1x was used. The remaining sizes
 * are new in 11, but 10g never references them, so it is safe to change the
 * values
 */
#define KFDASZ_1X      ((kfdasz)0)      /*    1x AU size                     */
#define KFDASZ_2X      ((kfdasz)1)      /*    2x AU size                     */
#define KFDASZ_4X      ((kfdasz)2)      /*    4x AU size                     */
#define KFDASZ_8X      ((kfdasz)3)      /*    8x AU size                     */
#define KFDASZ_16X     ((kfdasz)4)      /*   16x AU size                     */
#define KFDASZ_32X     ((kfdasz)5)      /*   32x AU size                     */
#define KFDASZ_64X     ((kfdasz)6)      /*   64x AU size                     */
#define KFDASZ_LAST    ((kfdasz)7)      /*   First unused value 11g          */
#define KFDASZ_LAST_10 ((kfdasz)4)      /*   First unused value 10g          */
#define KFDASZ_VALUE(x) ((ub1)(1 << (x)))
#endif /* KFDASZ_1X */

 

An extent is composed of one or more allocation units (AUs). An extent can be 1 AU, 4 AUs, 16 AUs, or 64 AUs. The extent size is encoded in two bits of the flags field as a kfdasz enumeration.

 


Posted

in

by

Tags:

Comments

One response to “【Oracle ASM】Variable Extent Size 原理”

  1. […] 数据盘区Data Extents 是裸的存储,用以存放文件内容。每一个Data Extent在 11g之前对应某一个ASM disk上的一个Allocation Unit , 在11g之后 一个Extent可以对应多个AU,具体见《【Oracle ASM】Variable Extent Size 原理》。 […]

Leave a Reply to 深入了解Oracle ASM(二):基础概念 – Oracle数据库数据恢复、性能优化来问问AskMaclean Cancel reply

Your email address will not be published. Required fields are marked *