View the table space usage in Oracle

Source: Internet
Author: User

Today, we will mainly describe how to use Oracle to view tablespaces. We hope you will learn how to use Oracle to view tablespaces. If you are interested in the actual operations, you can click to view the following articles. The following is an introduction to the text.

SELECT df. tablespace_name "tablespace ",

(Df. totalspace-NVL (fs. freespace, 0) "used (MB )",

NVL (fs. freespace, 0) "remaining (MB )",

Df. totalspace "Total (MB )",

ROUND (100 * (1-NVL (fs. freespace, 0)/df. totalspace), 2) "usage (% )"

 
 
  1. FROM (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) totalspace  
  2. FROM dba_data_files  
  3. GROUP BY tablespace_name) df,  
  4. (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) freespace  
  5. FROM dba_free_space  
  6. GROUP BY tablespace_name) fs  
  7. WHERE df.tablespace_name = fs.tablespace_name(+)  
  8. ORDER BY 5 DESC;  
  9. /*  

Oracle queries whether the table space needs to be compressed. SQL

Rem because Free Space Fragmentation is composed of several parts, such as the number of ranges and the maximum size of ranges, we can use FSFI -- Free Space Fragmentation Index) to intuitively reflect

Rem can change the default storage parameter pctincrease of a tablespace to a value other than 0. Generally, it is set to 1, so that SMON will automatically merge the free range. You can also manually merge the free range.

 
 
  1. rem FSFI Value Compute  
  2. column FSFI format 999,99  
  3. */  
  4. select tablespace_name,sqrt(max(blocks)/sum(blocks))
    *(100/sqrt(sqrt(count(blocks)))) FSFI  
  5. from dba_free_space  
  6. group by tablespace_name order by FSFI desc;  

The preceding content describes how to view the table space usage in Oracle. We hope it will help you in this regard.

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.