Here is script which calculates all text indexes sizes in Oracle Database:
------ partitioned text index size (select table_name, x.index_name, sum(MB) MB from (select substr(table_name, 4, instr(table_name, '#', -1) - 4) index_name, sum(bytes) / 1024 / 1024 MB from dba_tables t, dba_segments s where t.table_name = s.segment_name and t.table_name like 'DR$%$%' group by substr(table_name, 4, instr(table_name, '#', -1) - 4) union select substr(table_name, 4, instr(table_name, '#', -1) - 4) index_name, sum(bytes) / 1024 / 1024 MB from dba_indexes i, dba_segments s where i.index_name = s.segment_name and i.table_name like 'DR$%$%' group by substr(table_name, 4, instr(table_name, '#', -1) - 4)) x, dba_indexes ind where x.index_name = ind.index_name group by table_Name, x.index_name ) union --- not partitioned text index size (select table_name, x.index_name, sum(MB) MB from (select substr(table_name, 4, instr(table_name, '$', -1) - 4) index_name, sum(bytes) / 1024 / 1024 MB from dba_tables t, dba_segments s where t.table_name = s.segment_name and t.table_name like 'DR$%$%' group by substr(table_name, 4, instr(table_name, '$', -1) - 4) union select substr(table_name, 4, instr(table_name, '$', -1) - 4) index_name, sum(bytes) / 1024 / 1024 MB from dba_indexes i, dba_segments s where i.index_name = s.segment_name and i.table_name like 'DR$%$%' group by substr(table_name, 4, instr(table_name, '$', -1) - 4)) x, dba_indexes ind where x.index_name = ind.index_name group by table_Name, x.index_name ) order by table_name, index_name;
No comments:
Post a Comment