分析段增长和空间的需求
– 1,unused_space
/*
返回对象(表,索引,族)的未用空间;
*/
dbms_space.unused_space(
segment_owner =>,segment_name => ,segment_type => ,
total_blocks => ,total_bytes => ,
unused_blocks => ,unused_bytes => ,
last_used_extent_file_id => ,
last_used_extent_block_id => ,
last_used_block =>
);
declare
total_blocks number;
total_bytes number;
unused_blocks number;
unused_bytes number;
last_used_extent_file_id number;
last_used_extent_block_id number;
last_used_block number;
begin
dbms_space.unused_space(‘SYSTEM’,’T1’,’TABLE’,
total_blocks ,total_bytes,
unused_blocks,unused_bytes,
last_used_extent_file_id,
last_used_extent_block_id ,
last_used_block
);
dbms_output.put_line(total_blocks || ’ ’ || total_bytes);
dbms_output.put_line(unused_blocks || ’ ’ || unused_bytes);
dbms_output.put_line(last_used_extent_file_id);
dbms_output.put_line(last_used_extent_block_id);
dbms_output.put_line(last_used_block);
end;
– 2,free_blocks
/*
返回对象(表,索引,族)的的空闲块信息
freelist_group_id –指定段的空闲列表组号;
free_blks–空闲列表组的空闲列表个数
*/
dbms_space.free_blocks(
segment_owner => ,segment_name => ,segment_type =>,freelist_group_id => ,
free_blks =>
);
declare
free_blks int;
begin
dbms_space.free_blocks(‘SYSTEM’,’T’,’TABLE’,0,free_blks);
dbms_output.put_line(‘组0的空闲列表的个数:’ || free_blks);
end;
–3,space_usage
/*
返回段下数据块的使用情况;
unformatted –未格式化
fs1 – 剩余空间0-25%之间块的个数
fs2 – 剩余空间25%-50%之间块的个数
fs3 – 剩余空间50%-75%之间块的个数
fs4 – 剩余空间75%-100%之间块的个数
full –返回断的总计空间个数
*/
dbms_space.space_usage(
,segment_owner => ,
segment_name => ,
segment_type =>,
unformatted_blocks => ,unformatted_bytes => ,
fs1_blocks => ,fs1_bytes => ,
fs2_blocks => ,fs2_bytes => ,
fs3_blocks => ,fs3_bytes => ,
fs4_blocks => ,fs4_bytes => ,
full_blocks => ,full_bytes =>
);