暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

如何获得Oracle分区索引类型

843

碰巧在墨天轮上看资料就看到了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
OWNER
VARCHAR2(30)
NOT NULL
Owner of the partitioned index
INDEX_NAME
VARCHAR2(30)
NOT NULL
Name of the partitioned index
TABLE_NAME
VARCHAR2(30)
NOT NULL
Name of the partitioned table
PARTITIONING_TYPE
VARCHAR2(7)

Type of partitioning method:
  • RANGE

  • HASH

  • SYSTEM

  • LIST

SUBPARTITIONING_TYPE
VARCHAR2(7)

Type of composite partitioning method:
  • NONE

  • HASH

  • SYSTEM

  • LIST

PARTITION_COUNT
NUMBER
NOT NULL
Number of partitions in the index
DEF_SUBPARTITION_COUNT
NUMBER

For a composite-partitioned index, the default number of subpartitions, if specified
PARTITIONING_KEY_COUNT
NUMBER
NOT NULL
Number of columns in the partitioning key
SUBPARTITIONING_KEY_COUNT
NUMBER

For a composite-partitioned index, the number of columns in the subpartitioning key
LOCALITY
VARCHAR2(6)

Indicates whether the partitioned index is local (LOCAL
) or global (GLOBAL
)
ALIGNMENT
VARCHAR2(12)

Indicates whether the partitioned index is PREFIXED
 or NON_PREFIXED
DEF_TABLESPACE_NAME
VARCHAR2(30)

For a local index, the default tablespace to be used when adding or splitting a table partition
DEF_PCT_FREE
NUMBER
NOT NULL
For a local index, the default PCTFREE
 value to be used when adding a table partition
DEF_INI_TRANS
NUMBER
NOT NULL
For a local index, the default INITRANS
 to be used when adding a table partition
DEF_MAX_TRANS
NUMBER
NOT NULL
For a local index, the default MAXTRANS
 to be used when adding a table partition
DEF_INITIAL_EXTENT
VARCHAR2(40)
NOT NULL
For 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_EXTENT
VARCHAR2(40)
NOT NULL
For a local index, the default NEXT
 (in Oracle blocks), or DEFAULT
 if no NEXT
value was specified
DEF_MIN_EXTENTS
VARCHAR2(40)
NOT NULL
For 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_EXTENTS
VARCHAR2(40)
NOT NULL
For 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_INCREASE
VARCHAR2(40)
NOT NULL
For a local index, the default PCTINCREASE
 value to be used when adding a table partition, or DEFAULT
 if no PCTINCREASE
 value was specified
DEF_FREELISTS
NUMBER
NOT NULL
For 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_GROUPS
NUMBER
NOT NULL
For 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_LOGGING
VARCHAR2(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_POOL
VARCHAR2(7)

For a local index, the default buffer pool to be used when adding a table partition
DEF_PARAMETERS
VARCHAR2(1000)

Default parameter string for domain indexes


近期热文:

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

decode函数的妙用

虚拟内存详解

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

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

connect by超乎你想象

TOEIC科普一下

文章转载自bisal的个人杂货铺,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论