SQL: Indzies, die nicht partitioniert sind, obwohl die Tabelle partitioniert ist
Gib mir alle Indzies, die nicht partitioniert sind, obwohl die Tabelle partitioniert ist. (Das *KANN* in Ausnahmefällen sinnvoll sein. Macht i.d.R. aber wenig Sinn)
select AI.OWNER, AI.INDEX_NAME, AI.PARTITIONED, AI.TABLE_OWNER, AI.TABLE_NAME
from all_indexes AI
left outer join (
select AT.OWNER, AT.TABLE_NAME, AT.PARTITIONED
from all_tables AT
where owner in (UPPER ('MySchema1'), UPPER ('MySchema2'))
and AT.PARTITIONED = 'YES'
) TP on TP.OWNER = AI.TABLE_OWNER and TP.TABLE_NAME = AI.TABLE_NAME
where AI.table_owner in (UPPER ('MySchema1'), UPPER ('MySchema2'))
and AI.PARTITIONED != TP.PARTITIONED
;
(Oracle 12)
select AI.OWNER, AI.INDEX_NAME, AI.PARTITIONED, AI.TABLE_OWNER, AI.TABLE_NAME
from all_indexes AI
left outer join (
select AT.OWNER, AT.TABLE_NAME, AT.PARTITIONED
from all_tables AT
where owner in (UPPER ('MySchema1'), UPPER ('MySchema2'))
and AT.PARTITIONED = 'YES'
) TP on TP.OWNER = AI.TABLE_OWNER and TP.TABLE_NAME = AI.TABLE_NAME
where AI.table_owner in (UPPER ('MySchema1'), UPPER ('MySchema2'))
and AI.PARTITIONED != TP.PARTITIONED
;
(Oracle 12)
Kommentare
Kommentar veröffentlichen