您的位置:首页 > 数据库

查询当前用户数据库容量大小

2016-08-26 10:00 218 查看

     



      --首先查询用户默认空间

     select username,default_tablespace from user_users;

--然后
SELECT a.tablespace_name as 表空间名,

total as 表空间大小,

free 表空间剩余大小,

(total - free) 表空间使用大小,

total / (1024 * 1024 * 1024) 表空间大小G,

free / (1024 * 1024 * 1024) 表空间剩余大小G,

(total - free) / (1024 * 1024 * 1024) 表空间使用大小G,

round((total - free) / total, 4) * 100 使用率百分比

FROM (SELECT tablespace_name, SUM(bytes) free

FROM dba_free_space

GROUP BY tablespace_name) a,

(SELECT tablespace_name, SUM(bytes) total

FROM dba_data_files

GROUP BY tablespace_name) b

WHERE a.tablespace_name = b.tablespace_name

and a.tablespace_name = 'AUDIT_FLEX' --命名空间

order by a.tablespace_name;



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐