Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dbms_space.space_usage procedure for a schema

grapes12Nov 22 2013 — edited Nov 22 2013

I would like to choose all tables from a shema, instead of 1 table at a time.

I have this procedure, what adjustments would I need to do to get the relevant information.

[code]

set serveroutput on

declare
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     => UPPER('&OWNER'),
          segment_name      => UPPER('&NAME'),
          segment_type     => UPPER('&TYPE'),
          unformatted_blocks   => v_unformatted_blocks,
                               unformatted_bytes            => v_unformatted_bytes,
                               fs1_blocks                   => v_fs1_blocks,
                               fs1_bytes                    => v_fs1_bytes,
                               fs2_blocks                   => v_fs2_blocks,
                               fs2_bytes                    => v_fs2_bytes,
                               fs3_blocks                   => v_fs3_blocks,
                               fs3_bytes                    => v_fs3_bytes,
                               fs4_blocks                   => v_fs4_blocks,
                               fs4_bytes                    => v_fs4_bytes,
                               full_blocks                  => v_full_blocks,
          full_bytes     => v_full_bytes);

     dbms_output.put_line('Unformatted Blocks              = '||v_unformatted_blocks);
     dbms_output.put_line('Blocks with 00-25% free space   = '||v_fs1_blocks);
     dbms_output.put_line('Blocks with 26-50% free space   = '||v_fs2_blocks);
     dbms_output.put_line('Blocks with 51-75% free space   = '||v_fs3_blocks);
     dbms_output.put_line('Blocks with 76-100% free space  = '||v_fs4_blocks);
     dbms_output.put_line('Full Blocks                     = '||v_full_blocks);
end;
/

[/code]

I have over 2000 tables, and trying to do 1 at a time is time consuming.

Any help will be much appreciated.

Thanks this was exactly what I needed. What would I Need to add, to display partitioned tables though?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 20 2013
Added on Nov 22 2013
3 comments
995 views