0% found this document useful (0 votes)
15 views1 page

Change Storage

This SQL script selects alter table statements to change storage for tables that have an extent size larger than the largest free chunk in their tablespace. It joins the DBA_SEGMENTS and DBA_FREE_SPACE views to identify these tables and generates the SQL to alter their storage to the next 4M extent size.

Uploaded by

pepepekas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Change Storage

This SQL script selects alter table statements to change storage for tables that have an extent size larger than the largest free chunk in their tablespace. It joins the DBA_SEGMENTS and DBA_FREE_SPACE views to identify these tables and generates the SQL to alter their storage to the next 4M extent size.

Uploaded by

pepepekas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

spool change_storage_2.

sql
select 'alter table '||seg.owner||'.'||seg.segment_name ||' storage (next 4M);'
from dba_segments seg
,(select tablespace_name, max(bytes) maxchunk,
sum(bytes) totfree
from dba_free_space
group by tablespace_name) free
where seg.tablespace_name = free.tablespace_name
and seg.next_extent > free.maxchunk
and seg.tablespace_name not like 'TEMP%'
/
spool off

You might also like