|
-
I don't understand the question. First you said rebuilding your indexes. Next you said analyzing them. I don't see what the size of the index has to do with either.
If you want the size of multiple indexes you can do something liek this:
select segment_name, sum(bytes)
from dba_segments
where segment_type = 'INDEX'
and owner = 'MY_SCHEMA'
group by segment_name;
If you want to rebuild several indexes you can do something like this:
DECLARE
CURSOR c_indexes IS
SELECT owner || '.' || index_name as name
FROM dba_indexes
WHERE owner = 'MY_SCHEMA';
BEGIN
FOR cur_idx IN c_indexes LOOP
EXECUTE IMMEDIATE 'ALTER INDEX ' || cur_idx.name || ' REBUILD ONLINE;';
END LOOP;
END;
/
If you want to analyze several indexes you can do something like this:
DECLARE
CURSOR c_indexes IS
SELECT owner, index_name
FROM dba_indexes
WHERE owner = 'MY_SCHEMA';
BEGIN
FOR cur_idx IN c_indexes LOOP
DBMS_STATS.GATHER_INDEX_STATS(cur_idx.owner, cur_idx.index_name);
END LOOP;
END;
/
Perhaps you want to do a combination of these things???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|