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;
请问下我在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
不好意思 说错了 是查不到任何东西出来?
这是一个ASM type instance 的视图,不要在instance_type=RDBMS的实例中查询它。
[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可以)
我有一个疑问想请教一下。
确实像你说的那样,从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。
所以不知道这是怎么回事啊?
11.2.0.4 for OEL 6.3 RAC 查询ASM实例的x$kffxp ,是没有数据的,换成其它表了吗?
补充:在+ASM1上可以查到数据,+ASM2实例上没有数据
抱歉,刚才发现crs不正常(CRS-0184),但ASM和db都是正常的,重新启动后CRS正常,可以在2号节点上查询到x$kffxp数据了
This feature is automatic for newly created and resized datafiles when the disk group compatibility attributes are set to Oracle Release 11 or higher.