暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

oracle 表空间查看--包含自动扩展后的使用情况

原创 四九年入国军 2025-01-08
148
---查询表空间使用率(包括自动扩展)
col tablespace_name for a40
col CUR_PCT for a10
col EXT_PCT for a10
set linesize  1000
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(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,
                    (select tablespace_name, sum(bytes) free
                  from dba_free_space
                 group by tablespace_name) a
         where a.tablespace_name = b.tablespace_name)
 order by EXT_PCT desc;
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论