oracle-查看数据表容量大小

1.查看所有表,每张表占用大小(单位是Byte)
select segment_name, bytes
from user_segments
where segment_type = ‘TABLE’;
oracle-查看数据表容量大小_第1张图片

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’
) ;
oracle-查看数据表容量大小_第2张图片
此处换算成了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

你可能感兴趣的:(oracle,数据库)