SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 var1 number;
3 var2 number;
4 var3 number;
5 var4 number;
6 var5 number;
7 var6 number;
8 var7 number;
9 begin
10 dbms_space.unused_space('SYS','EMP','TABLE',var1,var2,var3,var4,var5,var6,var7);
11 dbms_output.put_line('object_name= space');
12 dbms_output.put_line('------------------');
13 dbms_output.put_line('tool_block ='||var1);
14 dbms_output.put_line('total_bytes ='||var2);
15 dbms_output.put_line('unused_blocks ='||var3);
16 dbms_output.put_line('unused_bytes='||var4);
17 dbms_output.put_line('last_used_extent_file_id ='||var5);
18 dbms_output.put_line('last_used_extent_block_id='||var6);
19 dbms_output.put_line('last_used_extent_block='||var7);
20
21 end;
22 /
object_name= space
------------------
tool_block =8
total_bytes =65536
unused_blocks =6
unused_bytes=49152
last_used_extent_file_id =1
last_used_extent_block_id=62889
last_used_extent_block=2
PL/SQL procedure successfully completed
------------------------
DBMS_SPACE.unused_space(segment_owner => ,segment_name => ,segment_type => ,total_blocks => ....)
segment_name 不是表空间名称,这个包只能查对象的空间使用情况。
segment_owner ,segment_name,segment_type 必须大写