-----------------------------------------------------------------------------
-- Kamil Piórek -- kamil.piorekk@gmail.com
set deferred_segment_creation = [TRUE | FALSE]
Deferred segment creation is also supported by the CREATE TABLE command. The syntax for this
is:
segment creation { IMMEDIATE | DEFERRED }
DECLARE
CURSOR segments_for_ext IS
select 'alter table '||table_owner||'.'||table_name||' modify partition '||partition_name||' allocate extent;' AS COL1
from dba_tab_partitions
--where segment_created = 'NO'
--and table_name = upper('tabletoshrink')
order by table_name, partition_name;
UNION ALL
SELECT 'alter table '||owner||'.'||table_name||' allocate extent;' FROM DBA_ALL_TABLES ; --where segment_created = 'NO' AND owner LIKE 'CM%'
BEGIN
FOR rec IN segments_for_ext
LOOP
EXECUTE IMMEDIATE rec.col1 ;
END LOOP ;
END ;
Komentarze
Prześlij komentarz