Use Oracle script to check object space usage

Source: Internet
Author: User

Tom has a very good script show_space.sql for viewing object space usage, as described below.

The introduction here is relatively simple, the following demo is actually for the table space information, as for the object, I will rewrite below.

The following example shows the effect of delete and truncate on high water levels, with script Space_usage.sql.

[Oracle@maa3 ~]$ Cat Space_usage.sql

--Space_usage.sql

Declare

L_tabname varchar2: = ' &1 ';

L_fs1_bytes number;

L_fs2_bytes number;

L_fs3_bytes number;

L_fs4_bytes number;

L_fs1_blocks number;

L_fs2_blocks number;

L_fs3_blocks number;

L_fs4_blocks number;

L_full_bytes number;

L_full_blocks number;

L_unformatted_bytes number;

L_unformatted_blocks number;

Begin

Dbms_space.space_usage (

Segment_owner => User,

Segment_name => L_tabname,

Segment_type => ' TABLE ',

Fs1_bytes => L_fs1_bytes,

Fs1_blocks => L_fs1_blocks,

Fs2_bytes => L_fs2_bytes,

Fs2_blocks => L_fs2_blocks,

Fs3_bytes => L_fs3_bytes,

Fs3_blocks => L_fs3_blocks,

Fs4_bytes => L_fs4_bytes,

Fs4_blocks => L_fs4_blocks,

Full_bytes => L_full_bytes,

Full_blocks => L_full_blocks,

Unformatted_blocks => L_unformatted_blocks,

Unformatted_bytes => L_unformatted_bytes

);

Dbms_output.put_line (' 0-25% free = ' | | l_fs1_blocks| | ' Bytes = ' | | L_fs1_bytes);

Dbms_output.put_line (' 25-50% free = ' | | l_fs2_blocks| | ' Bytes = ' | | L_fs2_bytes);

Dbms_output.put_line (' 50-75% free = ' | | l_fs3_blocks| | ' Bytes = ' | | L_fs3_bytes);

Dbms_output.put_line (' 75-100% free = ' | | l_fs4_blocks| | ' Bytes = ' | | L_fs4_bytes);

Dbms_output.put_line (' Full Blocks = ' | | l_full_blocks| | ' Bytes = ' | | L_full_bytes);

End

/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.