Oracle如何判定分区表索引是全局分区还是本地分区索引?分区表是自动增长还是非自动增长?

--索引全局还是本地

SELECT DISTINCT (B.LOCALITY)
FROM DBA_PART_INDEXES B
WHERE B.TABLE_NAME = 'TEST'
AND B.OWNER = 'A';

--是否自增长分区

SELECT DISTINCT A.INTERVAL
FROM DBA_TAB_PARTITIONS A
WHERE A.TABLE_NAME = 'TEST'
AND A.TABLE_OWNER = 'A';

---以上合并查询

SELECT DISTINCT A.INTERVAL, B.LOCALITY
FROM DBA_TAB_PARTITIONS A, DBA_PART_INDEXES B
WHERE A.TABLE_OWNER = B.OWNER
AND A.TABLE_NAME = B.TABLE_NAME
AND A.TABLE_NAME='TEST'
AND A.TABLE_OWNER ='A';

--查询结果:LOCAL 意味着是本地索引;GLOBAL 则意味着是全局索引;

--查询结果:NO 意味着分区表非自增长; YES 意味着分区表自增长;

---单表分区表,但是索引不是local 

 

select aa.owner, aa.table_name, aa.index_name, aa.index_type
from dba_indexes aa
where aa.table_name = 'T_PTS_QR_COUPON_TRANDATA'
and aa.index_name not in
(select b.index_name
from DBA_PART_INDEXES B
where B.TABLE_NAME = 'T_PTS_QR_COUPON_TRANDATA')

--针对全库 分区表,但是索引不是local 

select t.owner,t.table_name,i.index_name
from dba_part_tables t,dba_indexes i
where i.table_owner=t.owner
and i.table_name=t.table_name
and i.PARTITIONED='NO';

 

posted @ 2020-04-10 15:54  钱若梨花落  阅读(2438)  评论(0编辑  收藏  举报