Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Tablespace usage
Hi Robert,
See if this can help you
SELECT t.tablespace_name,
nvl(u.bytes,0)/1048576 megs_used, nvl(f.bytes,0)/1048576 megs_free, t.bytes/1048576 megs_total, nvl(f.max_bytes,0)/1048576 MAX_BYTES, nvl(n.next_extent,0)/1048576 MAX_NEXT_BYTES, (nvl(u.bytes,0)*100)/t.bytes pct_used, count(*) FRAGMENTS
(SELECT tablespace_name, sum(bytes) bytes
FROM dba_data_files a WHERE EXISTS (SELECT 'x' FROM dba_tablespaces b
WHERE b.tablespace_name = a.tablespace_name and b.status =
'ONLINE')
GROUP BY tablespace_name
UNION
SELECT ts.name,sum(bytes) bytes FROM v$tempfile tm,sys.ts$ ts
WHERE tm.ts#=ts.ts# GROUP BY ts.name ) t,
(
SELECT tablespace_name, max(next_extent) next_extent
FROM
(
SELECT table_name segment_name,
'TABLE' segment_type, owner,tablespace_name, initial_extent, next_exten
min_extents,max_extents,pct_increase FROM dba_tables
UNION
SELECt index_name segment_name, 'INDEX' segment_type,
owner,tablespace_name,
initial_extent,next_extent,min_extents,max_extents,pct_increase
FROM dba_i
UNION
SELECT segment_name,'ROLLBACK' segment_type,owner,tablespace_name,
initial_extent,
next_extent, min_extents, max_extents,pct_increase FROM
dba_rollback_segs
)v_segments
GROUP BY tablespace_name)
n, sys.ts$ a
WHERE t.tablespace_name = u.tablespace_name(+)
AND t.tablespace_name = f.tablespace_name(+) AND t.tablespace_name = n.tablespace_name(+) AND t.tablespace_name = a.name
With Warm regards
Jatinder Singh
Received on Mon Apr 24 2006 - 07:43:50 CDT