在日常运维中,可以使用如下SQL语句显示Oracle表空间使用率: SELECT a.tablespace_name, ROUND(a.total_size) "total_size(MB)", ROUND(a.total_size) - ROUND(b.free_size,3) "used_size(MB)", ROUND(b.free_size,3) "free_size(MB
在日常运维中,可以使用如下SQL语句显示Oracle表空间使用率:
SELECT a.tablespace_name, ROUND(a.total_size) "total_size(MB)", ROUND(a.total_size) - ROUND(b.free_size,3) "used_size(MB)", ROUND(b.free_size,3) "free_size(MB)", ROUND(b.free_size/total_size*100,2) || '%' free_rateFROM (SELECT tablespace_name,SUM(bytes)/1024/1024 total_size FROM dba_data_files GROUP BY tablespace_name) a, (SELECT tablespace_name,SUM(bytes)/1024/1024 free_size FROM dba_free_space GROUP BY tablespace_name) bWHERE a.tablespace_name = b.tablespace_name;
执行脚本后,显示效果如下:
更多Oracle相关信息见Oracle 专题页面 https://www.558idc.com/topicnews.aspx?tid=12