Oracle various space size and occupancy size ____oracle

Source: Internet
Author: User
1. Calculation method of table occupancy space size

Select s.segment_name, DECODE (sum (BYTES), NULL, 0, sum (BYTES)/1024/1024) Mbytes

From Dba_segments S

Where s.segment_name = ' mtl_material_transactions '-table name

and S.segment_type = ' TABLE '

Group by S.segment_name

2. Method of calculating the size of index occupancy space

Select s.segment_name, DECODE (sum (BYTES), NULL, 0, sum (BYTES)/1024/1024) Mbytes

From Dba_segments S

Where s.segment_name = ' mtl_material_transactions_n1 '--index

and S.segment_type = ' INDEX '

Group by S.segment_name

3. Calculation method of partition table occupancy space size

Select s.segment_name, DECODE (sum (BYTES), NULL, 0, sum (BYTES)/1024/1024) Mbytes

From Dba_segments S

Where s.segment_type = ' TABLE PARTITION '

Group by S.segment_name

4. Use of table space

SELECT a.tablespace_name table space name,

       Round (a.b Ytes, 2) "Total Space (g)",

       Round (b.bytes, 2) "unused Space (g)",

        ROUND ((a.bytes-b.bytes)/a.bytes) * 100, 2) "Usage%"

  from (SELECT Tablespace_name, SUM ( BYTES)/(1024 * 1024 * 1024) BYTES

          from Dba_data_files

         GROUP by Tablespace_name) A,

        (SELECT tablespace_name, SUM (BYTES)/(1024 * 1024 * 1024) BYTES

           from Dba_free_space

         GROUP by Tablespace_ NAME B

 where a.tablespace_name = b.tablespace_name

 order by (a.bytes-b.bytes)/a.bytes) DES C

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.