查询DB表实际大小

发布时间:2020-02-27 15:53:00 作者:00_yatou
来源:网络 阅读:674

1.查询DB表实际大小(保证clob/blob/nclob lob大字段)

 select round(sum(bytes/1024/1024/1024),2) ||'G' from dba_segments where owner='用户' 
 and segment_name ='表' OR segment_name IN (select SEGMENT_NAME from dba_LOBS where TABLE_NAME='表' and owner='用户');

如果不是dba用户可以用user_segments & user_lobs 且不需要owner.


2. 查询表里LOB大字段

   select round(sum(b.BYTES/1024/1024),2) ||'M' from dba_lobs a, dba_segments b  
 where a.segment_name = b.segment_name  and a.owner = '用户(大写)' and a.table_name = '表(大写)' ;


3.查询表大小不带LOB大字段

select round(sum(bytes/1024/1024/1024),2) ||'G' from user_segments where segment_name ='表';


4.表数据被删除

a. 若表的数据被truncate,上述方法查到的数据会立即变化

b. 若表的数据被delete,则需要对表进行收缩,上述查询才会变化;

 alter table 表名 enable row movement;
 alter table 表名 shrink space;


推荐阅读:
  1. 怎样查看Linux目录文件实际大小
  2. 查询复杂sql的表的大小

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle %d

上一篇:【MongoDB】管理命令收集

下一篇:初尝Swift-用Playground来学习Swift语言

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》