首页 > 其他 > 详细

查询表空间使用率(自动扩展的也能查噢)

时间:2019-01-27 10:10:41      阅读:275      评论:0      收藏:0      [点我收藏+]
col tablespace_name for a40
col CUR_PCT for a10
col EXT_PCT for a10
select 
tablespace,
current_used_mb,
total_mb,
can_extend_mb,
trunc(current_used_mb/total_mb*100,2)||% cur_pct,
trunc(current_used_mb/can_extend_mb*100,2)||% ext_pct,
count_file
from
(select
a.tablespace_name tablespace,
trunc((b.total-a.free)/1024/1024,2) current_used_mb,
trunc(b.total/1024/1024,2) total_mb,
trunc(b.extent_total/1024/1024) can_extend_mb,
b.count_file count_file
from
(select 
tablespace_name,
sum(bytes) free
from dba_free_space
group by tablespace_name) a,  
(select tablespace_name,                                         
sum(nvl(bytes,0)) total,                       
sum(decode(maxbytes,0,bytes,maxbytes)) extent_total,       
count(file_name) count_file                                    
from dba_data_files                                           
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name); 

技术分享图片

 

查询表空间使用率(自动扩展的也能查噢)

原文:https://www.cnblogs.com/nathon-wang/p/10325442.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!