COL TABLESPACE_NAME FORMAT A16
COL SEGMENT_NAME FORMAT A30
SET VERIFY OFF
SELECT E.TABLESPACE_NAME, E.SEGMENT_NAME,
TO_CHAR( SUM(E.BYTES)/1048576, '999990D00' ) " SIZE(MB)",
COUNT(*) FRAGS,
TO_CHAR( MAX(S.NEXT_EXTENT)/1048576, '999990D00' ) " NEXT(MB)"
FROM DBA_EXTENTS E, DBA_SEGMENTS S
WHERE E.OWNER=S.OWNER
AND E.SEGMENT_NAME=S.SEGMENT_NAME
AND E.TABLESPACE_NAME=S.TABLESPACE_NAME
AND E.OWNER=UPPER('&1.')
AND S.OWNER=UPPER('&1.')
AND E.TABLESPACE_NAME LIKE UPPER('&2.%')
AND S.TABLESPACE_NAME LIKE UPPER('&2.%')
GROUP BY E.TABLESPACE_NAME, E.SEGMENT_NAME
ORDER BY E.TABLESPACE_NAME, 3
/
SET VERIFY ON