1、创建分区表
CREATE TABLE "OSGIC"."TT"
(
"ID" VARCHAR2(32) NOT NULL ENABLE,
"BUSS_ID" VARCHAR2(64),
"REEST_TIME" DATE
)
PARTITION BY RANGE ("REEST_TIME") INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
(
PARTITION "PART_T01" VALUES LESS THAN (TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) TABLESPACE BTBS
)
2、创建索引
(1)、全局索引
create index osgic.idx_tt_id on OSGIC.TT (id);
(2)、本地索引
create index osgic.idx_tt_bussid on OSGIC.TT (buss_id) local;
3、查看索引
SELECT * FROM DBA_PART_INDEXES where table_name='TT';
该视图只能查询到本地local索引。
select * from dba_indexes where table_name='TT';
该视图可以查询到这个表的全部索引,但全局索引会有各类统计信息,而本地索引的各类统计信息是在DBA_PART_INDEXES视图中。