查看錶空間已經使用的百分比

查看錶空間已經使用的百分比
[html] view plaincopyprint?
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used" 
from 
(select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, 
(select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b 
where a.tablespace_name=b.tablespace_name 
order by ((a.bytes-b.bytes)/a.bytes) desc 
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used" from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name order by ((a.bytes-b.bytes)/a.bytes) desc
“Sum MB”表示表空間所有的數據文件總共在操作系統佔用磁盤空間的大小
比如:test表空間有2個數據文件,datafile1爲300MB,datafile2爲400MB,那麼test表空間的“Sum MB”就是700MB
“userd MB”表示表空間已經使用了多少
“free MB”表示表空間剩餘多少
“percent_user”表示已經使用的百分比

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章