--查看使用率 column TablespaceName format a40 heading 'Tablespace Name'
, E) ~; c5 X# s: Y, o column TotalUsedBytes format 9,999,999,999 heading 'File Sizes|(K)'+ C# ^6 i8 M% M4 M" g7 E; t' Y/ F. d% z
column TotalFreeBytes format 9,999,999,999 heading 'Free Bytes|(K)'0 \. a8 j" t9 b Z% q, U
column FreeRatio format 990.99 heading 'Free|(%)'3 m* x8 c) p5 O0 B% K- l
column TotalExtensibleBytes format 9,999,999,999 heading 'Extensible|Sizes (K)'2 Y5 s8 K/ H! J3 \8 \: J c' ?
column TotalExtends format 9999 heading 'Ext'
' L7 G7 |; j! L6 ]) T8 m compute sum label 'Total:' of TotalFreeBytes TotalUsedBytes TotalExtensibleBytes on report7 K, }5 F# I; v. w' G
break on report/ }' \) d7 H* W& W
select b.TablespaceName,/ w2 s9 }% y) M. [- G# |. ~, v+ m
round(sum(b.UsedByte) / 1024) TotalUsedBytes,
: K& a! |: B) y+ g0 ~ round(sum(a.FreeByte) / 1024) TotalFreeBytes,
4 T) K# v* ^* U# [ round(sum(b.ExtensibleByte) / 1024) TotalExtensibleBytes,) @, d5 K7 W# f7 B( o% f, U
round(sum(a.FreeByte + b.ExtensibleByte) * 100 / sum(b.UsedByte + b.ExtensibleByte), 2) FreeRatio,
( \6 m, Z* W# u3 d5 p. x$ f4 @ sum(a.Extend) TotalExtends1 {# V) A) x7 x8 o
from (select sum(bytes) FreeByte,
) A3 g8 `7 ^$ K) o& z count(*) Extend,2 C. O/ ]& T: e
file_id FileID,
' ^" t" M) v! A5 C8 x$ k4 Q6 Y tablespace_name TablespaceName& s. x+ Z- ?5 L+ C* C% P1 l/ J
from dba_free_space- O M( k$ Y0 v0 y8 b6 ~
group by file_id,% Y+ R% K* E: c' j, }5 u
tablespace_name
* r) T9 o8 c; U8 Z" n6 X( u0 N4 J union all2 [& \/ K+ n' f$ g, q5 f
select sum(bytes_free) FreeByte,2 U5 z7 [$ |" G8 v
count(*) Extend,
3 f: `/ z- _/ {7 v3 S1 C! Y2 K. g! d% h- T
file_id FileID, |