查詢ORACLE用戶表空間使用情況的SQL語句
select t.tablespace_name,
round(t.bytes / 1024 / 1024 / 1024, 2) || 'G' "總大小",
round((t.bytes - f.bytes) / 1024 / 1024 / 1024, 2) || 'G' "已使用",
round(100 * (t.bytes - f.bytes) / t.bytes, 2) || '%' "使用率"
from (select tablespace_name, sum(bytes) bytes
from dba_data_files
group by tablespace_name) t,
(select tablespace_name, sum(bytes) bytes
from dba_free_space
group by tablespace_name) f
where f.tablespace_name(+) = t.tablespace_name
round(t.bytes / 1024 / 1024 / 1024, 2) || 'G' "總大小",
round((t.bytes - f.bytes) / 1024 / 1024 / 1024, 2) || 'G' "已使用",
round(100 * (t.bytes - f.bytes) / t.bytes, 2) || '%' "使用率"
from (select tablespace_name, sum(bytes) bytes
from dba_data_files
group by tablespace_name) t,
(select tablespace_name, sum(bytes) bytes
from dba_free_space
group by tablespace_name) f
where f.tablespace_name(+) = t.tablespace_name
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.