How to know max_extent is reached?

Question:

Does anyone have a script that will be able to give me  when extents are
reaching max_extents

Answer1:

Following script will show the table which reach the max extents.

COLUMN "Segment Name" FORMAT A30
COLUMN "Ext"          FORMAT 999
COLUMN "Max Ext"      FORMAT 999
COLUMN "% Inc"        FORMAT 999
COLUMN "Owner"        FORMAT A6
COLUMN "Type"         FORMAT A6

SELECT  segment_type "Type",
        segment_name "Segment Name",
        extents "Ext",
        max_extents "Max Ext",
        next_extent "Next Ext",
        pct_increase "% Inc",
        owner "Owner"
FROM    dba_segments
WHERE   extents >= (max_extents*.9)
AND     segment_type <> 'CACHE'
/

Answer 2:

This will list table name, current extents and max extents.

select rpad(dt.table_name,30)||': '||
       lpad(to_char(ds.extents),3)||'/'||
       dt.max_extents
from sys.dba_segments ds,
     sys.dba_tables dt
where dt.owner = ds.owner
  and dt.table_name = ds.segment_name
  and ds.segment_type = 'TABLE'
order by dt.table_name;
 

Hosted by www.Geocities.ws

1