打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Oracle 查询表空间使用率 SQL 语句

Oracle 数据库的表空间如果使用超过100%,会导致数据库无法使用,因此需要及时扩展!

通过 sql 查询当前数据库所有表空间的使用率:

set line222
col pagesize1000
col TABLESPACE_NAME for a40select tbs_used_info.tablespace_name,   tbs_used_info.alloc_mb,   tbs_used_info.used_mb,   tbs_used_info.max_mb,   tbs_used_info.free_of_max_mb,   tbs_used_info.used_of_max || '%' used_of_max_pct  from (select a.tablespace_name,   round(a.bytes_alloc / 1024 / 1024) alloc_mb,   round((a.bytes_alloc - nvl(b.bytes_free,  0)) / 1024 / 1024) used_mb,   round((a.bytes_alloc - nvl(b.bytes_free,  0)) * 100 / a.maxbytes) used_of_max,   round((a.maxbytes - a.bytes_alloc + nvl(b.bytes_free,   0)) / 1048576) free_of_max_mb,   round(a.maxbytes / 1048576) max_mb          from (select f.tablespace_name,   sum(f.bytes) bytes_alloc,   sum(decode(f.autoextensible,  'YES',  f.maxbytes,  'NO',  f.bytes)) maxbytes                  from dba_data_files f                 group by tablespace_name) a,   (select f.tablespace_name,   sum(f.bytes) bytes_free                  from dba_free_space f                 group by tablespace_name) b         where a.tablespace_name = b.tablespace_name(+)) tbs_used_info order by tbs_used_info.used_of_max desc;

本次分享到此结束啦~

如果觉得文章对你有帮助,点赞、收藏、关注、评论,一键四连支持,你的支持就是我创作最大的动力。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
生产环境Oracle RAC扩表空间全记录
Linux宝库 - 正文 - Oracle的空间数据库管理技巧
oracle sql性能查证
主说明:自动Undo管理的故障排除指南(Doc ID 1579081.1)
Oracle 死锁分析过程详解
Oracle备份与恢复案例
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服