/* Formatted on 2012/10/9 10:24:19 (QP5 v5.114.809.3010) */
SELECT a.tablespace_name,
a.bytes_alloc/1024/1024 "megs_alloc(M)",
NVL (b.bytes_free, 0)/1024/1024 "megs_free(M)",
(a.bytes_alloc - NVL (b.bytes_free, 0))/1024/1024 "megs_used(M)",
ROUND ( (NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_free,
100 - ROUND ( (NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2)
pct_used
FROM ( SELECT f.tablespace_name,
SUM (f.BYTES) bytes_alloc,
SUM (DECODE (f.autoextensible,
'YES',
f.maxbytes,
'NO',
f.BYTES))
maxbytes
FROM dba_data_files f
GROUP BY tablespace_name) a,
( SELECT f.tablespace_name, SUM (f.BYTES) bytes_free
FROM dba_free_space f
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name(+)
UNION ALL
SELECT h.tablespace_name,
SUM (h.bytes_free + h.bytes_used) megs_alloc,
SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
megs_free,
SUM (NVL (p.bytes_used, 0)) megs_used,
ROUND (
(SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
/ SUM (h.bytes_used + h.bytes_free))
* 100,
2
)
pct_free,
100
- ROUND (
(SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
/ SUM (h.bytes_used + h.bytes_free))
* 100,
2
)
pct_used
FROM SYS.v_$temp_space_header h,
SYS.v_$temp_extent_pool p,
dba_temp_files f
WHERE p.file_id(+) = h.file_id
AND p.tablespace_name(+) = h.tablespace_name
AND f.file_id = h.file_id
AND f.tablespace_name = h.tablespace_name
GROUP BY h.tablespace_name, f.maxbytes
ORDER BY pct_used DESC
SELECT a.tablespace_name,
a.bytes_alloc/1024/1024 "megs_alloc(M)",
NVL (b.bytes_free, 0)/1024/1024 "megs_free(M)",
(a.bytes_alloc - NVL (b.bytes_free, 0))/1024/1024 "megs_used(M)",
ROUND ( (NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_free,
100 - ROUND ( (NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2)
pct_used
FROM ( SELECT f.tablespace_name,
SUM (f.BYTES) bytes_alloc,
SUM (DECODE (f.autoextensible,
'YES',
f.maxbytes,
'NO',
f.BYTES))
maxbytes
FROM dba_data_files f
GROUP BY tablespace_name) a,
( SELECT f.tablespace_name, SUM (f.BYTES) bytes_free
FROM dba_free_space f
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name(+)
UNION ALL
SELECT h.tablespace_name,
SUM (h.bytes_free + h.bytes_used) megs_alloc,
SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
megs_free,
SUM (NVL (p.bytes_used, 0)) megs_used,
ROUND (
(SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
/ SUM (h.bytes_used + h.bytes_free))
* 100,
2
)
pct_free,
100
- ROUND (
(SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0))
/ SUM (h.bytes_used + h.bytes_free))
* 100,
2
)
pct_used
FROM SYS.v_$temp_space_header h,
SYS.v_$temp_extent_pool p,
dba_temp_files f
WHERE p.file_id(+) = h.file_id
AND p.tablespace_name(+) = h.tablespace_name
AND f.file_id = h.file_id
AND f.tablespace_name = h.tablespace_name
GROUP BY h.tablespace_name, f.maxbytes
ORDER BY pct_used DESC