Oracle内部视图X$KFFXP

X$KFFXP是ASM(Automatic Storage Management)自动存储管理特性的重要内部视图,该视图反应了File Extent Map映射关系,ASM会将文件split成多个多个piece分片,这些分片被称为Extents。 在Disk上存放这些Extent的位置,就是我们常说的”Allocation Unit”。

 

KFF意为Kernel File,X$KFFXP即Kernel File Extent Maps, 该内部视图的一条记录代表一个Extent。

 

其字段含义如下:

 

GROUP_KFFXP        diskgroup number (1 - 63) ASM disk group number. Join with v$asm_disk and v$asm_diskgroup

NUMBER_KFFXP      file number for the extent ASM file number. Join with v$asm_file and v$asm_alias

COMPOUND_KFFXP    (group_kffxp << 24) + file # File identifier. Join with compound_index in v$asm_file

INCARN_KFFXP      file incarnation number File incarnation id. Join with incarnation in v$asm_file

PXN_KFFXP            physical extent number  Extent number per file

XNUM_KFFXP          extent number bit 31 set if indirect Logical extent
number per file (mirrored extents have the same value)

LXN_KFFXP            logical extent number 0,1 used to identify primary/mirror extent,
2 identifies file header allocation unit (hypothesis) used in the query such that
we go after only the primary extents, not secondary extents 

DISK_KFFXP          disk on which AU is located  Disk number where the extent is allocated.
Join with v$asm_disk Relative position of the allocation unit from the beginning of the disk. 

AU_KFFXP              AU number on disk of AU allocation unit size (1 MB) in v$asm_diskgroup

从11g开始加入了CHK_KFFXP SIZE_KFFXP 2个新的字段

CHK_KFFXP   未知 可能是范围为[0-256]的某种校验值

SIZE_KFFXP  size_kffxp is used such that we account for variable sized extents. 
sum(size_kffxp) provides the number of AUs that are on that disk.

 

在实例级别控制ASM Diskgroup AU 和 stripe size的是2个隐藏参数 _asm_ausize 1048576 以及 _asm_stripesize 131072。从11g开始一个Extent可能包含多个AU。

 

可以通过以下脚本查询文件与Extent等ASM属性的映射关系:

 

set linesize 140 pagesize 1400
col "FILE NAME" format a40
set head on
select NAME         "FILE NAME",
       NUMBER_KFFXP "FILE NUMBER",
       XNUM_KFFXP   "EXTENT NUMBER",
       DISK_KFFXP   "DISK NUMBER",
       AU_KFFXP     "AU NUMBER",
       SIZE_KFFXP   "NUMBER of AUs"
  from x$kffxp, v$asm_alias
 where GROUP_KFFXP = GROUP_NUMBER
   and NUMBER_KFFXP = FILE_NUMBER
   and system_created = 'Y'
   and lxn_kffxp = 0
 order by name;

Posted

in

by

Tags:

Comments

13 responses to “Oracle内部视图X$KFFXP”

  1. maclean Avatar
    maclean
    SQL> select s.name,STRIPED
      2    from v$asm_file a, v$asm_alias s
      3   where a.GROUP_NUMBER = s.GROUP_NUMBER
      4     and a.FILE_NUMBER = s.FILE_NUMBER
      5     and STRIPED = 'FINE' 
      6     /
    
    NAME                                                                   STRIPE
    ---------------------------------------------------------------------- ------
    Backup.263.769482651                                                   FINE
    Current.260.766620025                                                  FINE
    Current.261.766620025                                                  FINE
    Backup.481.769484083                                                   FINE
    
    SQL> set linesize 140 pagesize 1400
    SQL> col "FILE NAME" format a40
    SQL> set head on
    SQL> select NAME         "FILE NAME",
      2         NUMBER_KFFXP "FILE NUMBER",
      3         XNUM_KFFXP   "EXTENT NUMBER",
      4         DISK_KFFXP   "DISK NUMBER",
      5         AU_KFFXP     "AU NUMBER"
      6    from x$kffxp, v$asm_alias
      7   where GROUP_KFFXP = GROUP_NUMBER
      8     and NUMBER_KFFXP = FILE_NUMBER
      9     and name in ('Backup.263.769482651',
     10  'Current.260.766620025',
     11  'Current.261.766620025',
     12  'Backup.481.769484083')
     13   order by  DISK_KFFXP,AU_KFFXP;
    
    FILE NAME                                FILE NUMBER EXTENT NUMBER DISK NUMBER  AU NUMBER
    ---------------------------------------- ----------- ------------- ----------- ----------
    Backup.263.769482651                             263             1           0        416
    Backup.263.769482651                             263            11           0        417
    Backup.263.769482651                             263            20           0        418
    Current.261.766620025                            261             1           0        625
    Current.261.766620025                            261             4           0        626
    Current.261.766620025                            261             6           0        627
    Current.261.766620025                            261             8           0        628
    Current.261.766620025                            261            10           0        629
    Current.261.766620025                            261            12           0        630
    Current.261.766620025                            261            14           0        631
    Current.261.766620025                            261            16           0        632
    Current.261.766620025                            261            18           0        633
    Current.261.766620025                            261            21           0        634
    Current.261.766620025                            261            23           0        635
    Current.260.766620025                            260             1           0        636
    Current.260.766620025                            260             4           0        637
    Current.260.766620025                            260             6           0        638
    Current.260.766620025                            260             8           0        639
    Current.260.766620025                            260            10           0        640
    Current.260.766620025                            260            12           0        641
    Current.260.766620025                            260            14           0        642
    Current.260.766620025                            260            16           0        643
    Current.260.766620025                            260            18           0        644
    Current.260.766620025                            260            21           0        645
    Current.260.766620025                            260            23           0        646
    Backup.481.769484083                             481             0           0      10715
    Backup.481.769484083                             481             3           0      10716
    Backup.481.769484083                             481             5           0      10717
    Backup.481.769484083                             481             7           0      10718
    Backup.481.769484083                             481             9           0      10719
    Backup.481.769484083                             481            11           0      10720
    Backup.481.769484083                             481            13           0      10721
    Backup.481.769484083                             481            15           0      10722
    Backup.481.769484083                             481            17           0      10723
    Backup.481.769484083                             481            20           0      10724
    Backup.481.769484083                             481            22           0      10725
    Current.261.766620025                            261             0           1        626
    Current.261.766620025                            261             3           1        627
    Current.261.766620025                            261             5           1        628
    Current.261.766620025                            261             7           1        629
    Current.261.766620025                            261             9           1        630
    Current.261.766620025                            261            11           1        631
    Current.261.766620025                            261            13           1        632
    Current.261.766620025                            261            15           1        633
    Current.261.766620025                            261            17           1        634
    Current.261.766620025                            261            19           1        635
    Current.261.766620025                            261            22           1        636
    Current.260.766620025                            260             0           1        637
    Current.260.766620025                            260             3           1        638
    Current.260.766620025                            260             5           1        639
    Current.260.766620025                            260             7           1        640
    Current.260.766620025                            260             9           1        641
    Current.260.766620025                            260            11           1        642
    Current.260.766620025                            260            13           1        643
    Current.260.766620025                            260            15           1        644
    Current.260.766620025                            260            17           1        645
    Current.260.766620025                            260            19           1        646
    Current.260.766620025                            260            22           1        647
    Backup.263.769482651                             263             0           1       3333
    Backup.263.769482651                             263             2           1       3334
    Backup.263.769482651                             263             3           1       3335
    Backup.263.769482651                             263             4           1       3336
    Backup.263.769482651                             263             5           1       3337
    Backup.263.769482651                             263             6           1       3338
    Backup.263.769482651                             263             7           1       3339
    Backup.263.769482651                             263             8           1       3340
    Backup.263.769482651                             263             9           1       3341
    Backup.263.769482651                             263            10           1       3342
    Backup.263.769482651                             263            12           1       3343
    Backup.263.769482651                             263            13           1       3344
    Backup.263.769482651                             263            14           1       3345
    Backup.263.769482651                             263            15           1       3346
    Backup.263.769482651                             263            16           1       3347
    Backup.263.769482651                             263            17           1       3348
    Backup.263.769482651                             263            18           1       3349
    Backup.263.769482651                             263            19           1       3350
    Backup.263.769482651                             263            21           1       3351
    Backup.263.769482651                             263            22           1       3352
    Backup.263.769482651                             263            23           1       3353
    Backup.481.769484083                             481             1           1      10727
    Backup.481.769484083                             481             4           1      10728
    Backup.481.769484083                             481             6           1      10729
    Backup.481.769484083                             481             8           1      10730
    Backup.481.769484083                             481            10           1      10731
    Backup.481.769484083                             481            12           1      10732
    Backup.481.769484083                             481            14           1      10733
    Backup.481.769484083                             481            16           1      10734
    Backup.481.769484083                             481            18           1      10735
    Backup.481.769484083                             481            21           1      10736
    Backup.481.769484083                             481            23           1      10737
    Current.261.766620025                            261             2           2         81
    Current.261.766620025                            261            20           2         82
    Current.260.766620025                            260             2           2         83
    Current.260.766620025                            260            20           2         84
    Backup.481.769484083                             481             2           2       1362
    Backup.481.769484083                             481            19           2       1363
    
    96 rows selected.
    
      1  select NAME         "FILE NAME",
      2         NUMBER_KFFXP "FILE NUMBER",
      3         PXN_KFFXP,
      4         XNUM_KFFXP   "EXTENT NUMBER",
      5         DISK_KFFXP   "DISK NUMBER",
      6         AU_KFFXP     "AU NUMBER",
      7         SIZE_KFFXP
      8    from x$kffxp, v$asm_alias
      9   where GROUP_KFFXP = GROUP_NUMBER
     10     and NUMBER_KFFXP = FILE_NUMBER
     11     and name   ='Current.260.766620025'
     12*  order by XNUM_KFFXP,DISK_KFFXP, AU_KFFXP
    SQL> /
    
    FILE NAME                                FILE NUMBER  PXN_KFFXP EXTENT NUMBER DISK NUMBER  AU NUMBER SIZE_KFFXP
    ---------------------------------------- ----------- ---------- ------------- ----------- ---------- ----------
    Current.260.766620025                            260          0             0           1        637          1
    Current.260.766620025                            260          1             1           0        636          1
    Current.260.766620025                            260          2             2           2         83          1
    Current.260.766620025                            260          3             3           1        638          1
    Current.260.766620025                            260          4             4           0        637          1
    Current.260.766620025                            260          5             5           1        639          1
    Current.260.766620025                            260          6             6           0        638          1
    Current.260.766620025                            260          7             7           1        640          1
    Current.260.766620025                            260          8             8           0        639          1
    Current.260.766620025                            260          9             9           1        641          1
    Current.260.766620025                            260         10            10           0        640          1
    Current.260.766620025                            260         11            11           1        642          1
    Current.260.766620025                            260         12            12           0        641          1
    Current.260.766620025                            260         13            13           1        643          1
    Current.260.766620025                            260         14            14           0        642          1
    Current.260.766620025                            260         15            15           1        644          1
    Current.260.766620025                            260         16            16           0        643          1
    Current.260.766620025                            260         17            17           1        645          1
    Current.260.766620025                            260         18            18           0        644          1
    Current.260.766620025                            260         19            19           1        646          1
    Current.260.766620025                            260         20            20           2         84          1
    Current.260.766620025                            260         21            21           0        645          1
    Current.260.766620025                            260         22            22           1        647          1
    Current.260.766620025                            260         23            23           0        646          1
    
    24 rows selected.
    
    
  2. xieyihn Avatar
    xieyihn

    请问下我在11gR2版为什么查不到此视图啊?

    SQL> show user;
    USER is “SYS”

    SQL> select * from x$kffxp;
    no rows selected

    SQL> select name from v$datafile;
    NAME
    ——————————————————————————–
    +DATA/testdb/datafile/system.263.784600547
    +DATA/testdb/datafile/sysaux.262.784600547
    +DATA/testdb/datafile/undotbs1.261.784600547
    +DATA/testdb/datafile/users.259.784600547
    +DATA/testdb/test/tbs01.dbf

    SQL> desc x$kffxp;
    Name Null? Type
    —————————————– ——– —————————-
    ADDR RAW(4)
    INDX NUMBER
    INST_ID NUMBER
    GROUP_KFFXP NUMBER
    NUMBER_KFFXP NUMBER
    COMPOUND_KFFXP NUMBER
    INCARN_KFFXP NUMBER
    PXN_KFFXP NUMBER
    XNUM_KFFXP NUMBER
    LXN_KFFXP NUMBER
    DISK_KFFXP NUMBER
    AU_KFFXP NUMBER
    FLAGS_KFFXP NUMBER
    CHK_KFFXP NUMBER
    SIZE_KFFXP NUMBER

    SQL> select * from x$kffxp;
    no rows selected

    1. xieyihn Avatar
      xieyihn

      不好意思 说错了 是查不到任何东西出来?

      1. Maclean Liu Avatar

        这是一个ASM type instance 的视图,不要在instance_type=RDBMS的实例中查询它。

        1. xieyihn Avatar
          xieyihn

          [grid@test01 admin]$ sqlplus / as sysasm

          SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 29 11:39:52 2012

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

          Connected to:
          Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
          With the Automatic Storage Management option
          SQL> select instance_name,status from v$instance;

          INSTANCE_NAME STATUS
          —————- ————
          +ASM STARTED

          嗯,换了实例可以查询了,TKS。
          不过还请教一个问题,asm实例的状态为started,我在远程client应该怎么连上去呢? (好像见过10G可以)

  3. neverland_83 Avatar
    neverland_83

    我有一个疑问想请教一下。
    确实像你说的那样,从11g开始,oracle支持Variable-Size Extents,在他的官方文档中如是描述:
    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+).
    也就是文件的extent编号超过20000,每个extent就会有4AU,
    extent编号超过40000,每个extent就会有16AU。
    这样的好处当然是可以减小维护extent map所占用的空间。

    但是现在让我比较崩溃的是,在我自己的一个11gR2的RAC环境上,我查询出来却貌似不是oracle文档中说的这样。
    我用的查询是在你的查询基础上修改了一点点:
    SQL> select * from (select NAME “FILE NAME”,
    NUMBER_KFFXP “FILE NUMBER”,
    XNUM_KFFXP “EXTENT NUMBER”,
    DISK_KFFXP “DISK NUMBER”,
    AU_KFFXP “AU NUMBER”,
    SIZE_KFFXP “NUMBER of AUs”
    from x$kffxp, v$asm_alias
    where GROUP_KFFXP = GROUP_NUMBER
    and NUMBER_KFFXP = FILE_NUMBER
    and system_created = ‘Y’
    and lxn_kffxp = 0
    and NUMBER_KFFXP=293
    and XNUM_KFFXP != 2147483648
    order by AU_KFFXP desc) where rownum < 10; 2 3 4 5 6 7 8 9 10 11 12 13 14

    FILE NAME FILE NUMBER EXTENT NUMBER DISK NUMBER AU NUMBER NUMBER of AUs
    ———————— ———– ————- ———– ———- ————-
    TPCH1T.293.811454469 293 72638 3 20412 1
    TPCH1T.293.811454469 293 72639 8 20412 1
    TPCH1T.293.811454469 293 72628 3 20411 1
    TPCH1T.293.811454469 293 72634 5 20411 1
    TPCH1T.293.811454469 293 72629 8 20411 1
    TPCH1T.293.811454469 293 72618 3 20410 1
    TPCH1T.293.811454469 293 72624 5 20410 1
    TPCH1T.293.811454469 293 72619 8 20410 1
    TPCH1T.293.811454469 293 72608 3 20409 1

    9 rows selected.

    可以看到Extent Number都已经7、8万了,但是AUs仍然是1,并没有像oracle文档中说的那样变为16AU。
    所以不知道这是怎么回事啊?

  4. 丁丁 Avatar
    丁丁

    11.2.0.4 for OEL 6.3 RAC 查询ASM实例的x$kffxp ,是没有数据的,换成其它表了吗?

    1. 丁丁 Avatar
      丁丁

      补充:在+ASM1上可以查到数据,+ASM2实例上没有数据

      1. 丁丁 Avatar
        丁丁

        抱歉,刚才发现crs不正常(CRS-0184),但ASM和db都是正常的,重新启动后CRS正常,可以在2号节点上查询到x$kffxp数据了

  5. roger Avatar
    roger

    This feature is automatic for newly created and resized datafiles when the disk group compatibility attributes are set to Oracle Release 11 or higher.

Leave a Reply

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