如何获得Oracle分区索引类型

碰巧在墨天轮上看资料就看到了eygle的这篇文章《如何获得 Oracle 分区索引的类型 - 全局分区索引、本地分区索引》,秉承了eygle大神一如既往的风格,文章“短小”,但是“精悍”,从我看eygle的第一本书开始,就记住了他这句“由点及面”,不仅在数据库领域中,在其他工作领域,这种学习方法,都是适用的。正所谓“授之以鱼不如授之以渔”。

P.S. https://www.modb.pro/db/23633?from=timeline&isappinstalled=0

Oracle数据库针对分区的信息,通过多个数据字典视图来维护,所以在获取信息时,经常会困惑DBA们。

例如,如何获取分区索引的类型,如何判断一个索引,是全局分区索引,还是本地分区索引?

通过DBA_PART_INDEXES中的LOCALITY字段就可以判断:

SQL> select distinct (locality) from  dba_part_indexes;

LOCALI
------
LOCAL

LOCAL意味着是本地索引;GLOBAL则意味着是全局索引。

DBA_PART_INDEXES和ALL_PART_INDEXES、USER_PART_INDEXES视图的字段相同,分别展示的是数据库(DBA级别)、用户权限级别(ALL)和用户所属级别(USER)的分区索引信息。

至于分区类型等,可以通过这个视图查询获得:

SQL> select TABLE_NAME,PARTITIONING_TYPE,LOCALITY from dba_part_indexes where rownum < 10;

TABLE_NAME					   PARTITION LOCALI
-------------------------------------------------- --------- ------
STREAMS$_APPLY_SPILL_MSGS_PART			   LIST      LOCAL
STREAMS$_APPLY_SPILL_MSGS_PART			   LIST      LOCAL
LOGMNRC_CONCOL_GG				   RANGE     LOCAL
LOGMNRC_CON_GG					   RANGE     LOCAL
LOGMNRC_CON_GG					   RANGE     LOCAL
LOGMNRC_CON_GG					   RANGE     LOCAL
LOGMNRC_GSBA					   RANGE     LOCAL
LOGMNRC_GSII					   RANGE     LOCAL
LOGMNRC_GTCS					   RANGE     LOCAL

视图信息引入如下,供参考:

ColumnDatatypeNULLDescription
OWNERVARCHAR2(30)NOT NULLOwner of the partitioned index
INDEX_NAMEVARCHAR2(30)NOT NULLName of the partitioned index
TABLE_NAMEVARCHAR2(30)NOT NULLName of the partitioned table
PARTITIONING_TYPEVARCHAR2(7)
Type of partitioning method:
  • RANGE

  • HASH

  • SYSTEM

  • LIST

SUBPARTITIONING_TYPEVARCHAR2(7)
Type of composite partitioning method:
  • NONE

  • HASH

  • SYSTEM

  • LIST

PARTITION_COUNTNUMBERNOT NULLNumber of partitions in the index
DEF_SUBPARTITION_COUNTNUMBER
For a composite-partitioned index, the default number of subpartitions, if specified
PARTITIONING_KEY_COUNTNUMBERNOT NULLNumber of columns in the partitioning key
SUBPARTITIONING_KEY_COUNTNUMBER
For a composite-partitioned index, the number of columns in the subpartitioning key
LOCALITYVARCHAR2(6)
Indicates whether the partitioned index is local (LOCAL) or global (GLOBAL)
ALIGNMENTVARCHAR2(12)
Indicates whether the partitioned index is PREFIXED or NON_PREFIXED
DEF_TABLESPACE_NAMEVARCHAR2(30)
For a local index, the default tablespace to be used when adding or splitting a table partition
DEF_PCT_FREENUMBERNOT NULLFor a local index, the default PCTFREE value to be used when adding a table partition
DEF_INI_TRANSNUMBERNOT NULLFor a local index, the default INITRANS to be used when adding a table partition
DEF_MAX_TRANSNUMBERNOT NULLFor a local index, the default MAXTRANS to be used when adding a table partition
DEF_INITIAL_EXTENTVARCHAR2(40)NOT NULLFor a local index, the default INITIAL value (in Oracle blocks) to be used when adding a table partition, or DEFAULT if no INITIAL value was specified
DEF_NEXT_EXTENTVARCHAR2(40)NOT NULLFor a local index, the default NEXT (in Oracle blocks), or DEFAULT if no NEXTvalue was specified
DEF_MIN_EXTENTSVARCHAR2(40)NOT NULLFor a local index, the default MINEXTENTS value to be used when adding a table partition, or DEFAULT if no MINEXTENTS value was specified
DEF_MAX_EXTENTSVARCHAR2(40)NOT NULLFor a local index, the default MAXEXTENTS value to be used when adding a table partition, or DEFAULT if no MAXEXTENTS value was specified
DEF_PCT_INCREASEVARCHAR2(40)NOT NULLFor a local index, the default PCTINCREASE value to be used when adding a table partition, or DEFAULT if no PCTINCREASE value was specified
DEF_FREELISTSNUMBERNOT NULLFor a local index, the default FREELISTS value to be used when adding a table partition, or DEFAULT if no FREELISTS value was specified
DEF_FREELIST_GROUPSNUMBERNOT NULLFor a local index, the default FREELIST GROUPS value to be used when adding a table partition, or DEFAULT if no FREELIST GROUPS value was specified
DEF_LOGGINGVARCHAR2(7)
For a local index, the default LOGGING attribute to be used when adding a table partition, or DEFAULT if no LOGGING attribute was specified
DEF_BUFFER_POOLVARCHAR2(7)
For a local index, the default buffer pool to be used when adding a table partition
DEF_PARAMETERSVARCHAR2(1000)
Default parameter string for domain indexes

近期热文:

《decode函数的妙用》网友的两个问题解答

decode函数的妙用

虚拟内存详解

7号球衣的故事:重要的不是号码,而是穿着它的人

插入"&"特殊字符的几种思考

connect by超乎你想象

TOEIC科普一下

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值