Oracle分析和计算表的碎片情况
-- 查询表的碎片情况
SELECT table_name,
round((blocks*8),2) as "Size (KB)",
round((num_rows*(avg_row_len/1024),2)) as "Actual Data (KB)"
FROM user_tables
WHERE table_name = 'YOUR_TABLE_NAME_IN_UPPERCASE';
-- 查询表的碎片情况的扩展信息
SELECT table_name,
round((blocks*8),2) as "Size (KB)",
round((num_rows*(avg_row_len/1024),2)) as "Actual Data (KB)",
round((blocks*8) - (num_rows*(avg_row_len/1024)),2) as "Wasted Space (KB)"
FROM user_tables
WHERE table_name = 'YOUR_TABLE_NAME_IN_UPPERCASE';
替换YOUR_TABLE_NAME_IN_UPPERCASE
为你需要查询的表名,并确保表名是大写的,因为Oracle中的用户表是大小写敏感的,并且在数据字典中表名通常是大写的。
评论已关闭