用于分析table的内存使用情况space_usage

本文介绍了一个使用PL/SQL编写的程序,该程序通过输入表名来查询Oracle数据库中指定表的表空间使用情况,包括未格式化块、不同填充率范围内的块数量及其所占字节数等详细信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

set serveroutput on size 10000;
declare
v_tabname varchar2(30) :='&1';
v_unformatted_blocks number;
v_unformatted_bytes number;
v_fs1_blocks number;
v_fs1_bytes number;
v_fs2_blocks number;
v_fs2_bytes number;
v_fs3_blocks number;
v_fs3_bytes number;
v_fs4_blocks number;
v_fs4_bytes number;
v_full_blocks number;
v_full_bytes number;
begin
dbms_space.space_usage (
segment_owner =>'BJWSKP',
segment_name   =>v_tabname,
segment_type    =>'TABLE',
v_unformatted_blocks =>v_unformatted_blocks,
v_unformatted_bytes =>v_unformatted_bytes,
v_fs1_blocks =>v_fs1_blocks,
v_fs1_bytes =>v_fs1_bytes,
v_fs2_blocks =>v_fs2_blocks,
v_fs2_bytes =>v_fs2_bytes,
v_fs3_blocks =>v_fs3_blocks,
v_fs3_bytes =>v_fs3_bytes,
v_fs4_blocks =>v_fs4_blocks,
v_fs4_bytes =>v_fs4_bytes,
v_full_blocks =>v_full_blocks,
v_full_bytes =>v_full_bytes);
dbms_output.put_line('Unformatted Blocks = '||v_unformatted_blocks);
dbms_output.put_line('FS1 0-25% Blocks = '||v_fs1_blocks||' Bytes = '||v_fs1_bytes);
dbms_output.put_line('FS2 25-50% Blocks = '||v_fs2_blocks||' Bytes = '||v_fs2_bytes);
dbms_output.put_line('FS3 50-75% Blocks = '||v_fs3_blocks||' Bytes = '||v_fs3_bytes);
dbms_output.put_line('FS4 75-100% Blocks = '||v_fs4_blocks||' Bytes = '||v_fs4_bytes);
dbms_output.put_line('Full Blocks = '||v_full_blocks||' Bytes = '||v_full_bytes);
end;
/


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值