本文转自:https://blog.csdn.net/shuaishuai1234/article/details/84870700

1.查看所有表,每张表占用大小(单位是Byte)
select segment_name, bytes
from user_segments
where segment_type = ‘TABLE’;

2.查看其中几张表大小
需要再加判断条件:segment_name–表名

select round(sum(bytes)/1024/1024/1024,4) GB
from user_segments
where segment_type = ‘TABLE’ and lower(segment_name) in (
‘cic_accident_insurance’,
‘cic_apply_base’,
‘cic_policy_base’,
‘cic_policy_detail_info’,
‘cic_policy_info’,
‘crm_agency_user’,
‘crm_customer_info’,
‘crm_order_query’,
‘prprinsured’,
‘renewalpolicy’
) ;

此处换算成了GB,并且只是查了重点的几张表,数据库名字也转换成小写查询

还有一些查询需要DBA权限,诸如表空间大小等等

查看所有表的数据量并排序
select t.table_name,t.num_rows from user_tables t ORDER BY NUM_ROWS DESC;
还可以直接查看dblink的:
select t.table_name,t.num_rows from user_tables@dblink t ORDER BY NUM_ROWS DESC;

参考链接:
https://www.cnblogs.com/pejsidney/p/8057372.html
https://www.cnblogs.com/30go/p/5970830.html
————————————————
版权声明:本文为CSDN博主「如此简单^_^」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/shuaishuai1234/article/details/84870700