<jsp:directive.page pageEncoding="UTF-8" />
select * from
(select 
 ds.tablespace_name,
 ds.owner,
 ds.segment_name||':'||ds.partition_name  SEGMENTNAME,
 ds.segment_type,
 ts.extent_management,
 ds.max_extents                           MAXEXTENT,
 round((ds.extents/ds.max_extents)*100,0) PCT_EXT,
 ds.extents
from dba_segments ds,dba_tablespaces ts
where 
 ds.tablespace_name=ts.tablespace_name and
 ds.max_extents != 0 and
 extents >= 3
union
select 
 ds.tablespace_name,
 ds.owner,
 ds.segment_name||':'||ds.partition_name  SEGMENTNAME,
 ds.segment_type,
 ts.extent_management,
 ds.max_extents                           MAXEXTENT,
round((ds.extents/ds.max_extents)*100,0)  PCT_EXT,
 ds.extents
from dba_segments ds,dba_tablespaces ts
where 
 ds.tablespace_name=ts.tablespace_name and
 ds.max_extents != 0 and
 ds.extents*100 >= ds.max_extents*60
 )
where owner != 'SYS'
order by 5,1 desc,8 desc,2,3
