oracle查询表数据占用字节

查看oracle中的中文所占字节数

select userenv('language') from dual

  

显示:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
表示一个汉字占用两个字节。

显示:SIMPLIFIED CHINESE_CHINA.AL32UTF8
表示一个汉字占用三个字节。

还可以使用下列方式验证,一个中文所占的字节数:

select lengthb('中') from dual

  

-- 1、先优化统计表(表中数据有修改或有变化时,要先执行分析,否则下面第2步不能正确计算。)

analyze table 你的表名 compute statistics;

例:

analyze table F_D_ARGS_CHECK compute statistics;

  

-- 2,根据表列的长度与行数计算平均数 查询表数据占用字节

select table_name, num_rows,avg_row_len, num_rows * avg_row_len 
from user_tables 
where table_name = '你的表名';

例:

select num_rows * avg_row_len 
from user_tables 
where table_name = 'F_D_ARGS_CHECK';

  

原文地址:https://www.cnblogs.com/wzihan/p/14745567.html