一、獲取某個用戶下Oracle某個表行記錄的長度
這個長度是表字段定義的長度,獲取方法:
1.select owner,
2. table_name,
3. column_name,
4. data_type,
5. data_length,
6. sum(case data_type
7. when 'DATE' then
8. 7
9. when 'NUMBER' then
10. 22
11. else
12. data_length
13. end) length
14. from all_tab_cols
15. where table_name = upper('表名')
16. and DATA_TYPE
17. and owner=upper('用戶名')
18. group by rollup((owner, table_name, column_name, data_type, data_length))
二、根據表數據所占總字節數和表記錄數來獲取實際的每行記錄的平均長度
獲取表數據的所有字節數:
1.select segment_name,
2. segment_type,
3. nvl(sum(bytes), 0)
4. from user_segments
5. where segment_type = 'TABLE'
6. and segment_name = '表名'
7. group by segment_name, segment_type
8. order by 3 desc;
獲取表總記錄數:
select count(*) from 表名
兩者求商即得每行記錄的平均字節數。 本文出自:億恩科技【www.laynepeng.cn】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]
|