Oracle SQL statements for querying space usage

Source: Internet
Author: User

Several SQL statements about oracle space usage query 1. View Tablespace usage col Tablespace format a24col "% Used" for 99.99 select df. tablespace_name "Tablespace", df. bytes/(1024*1024) "Total Size (MB)", sum (fs. bytes)/(1024*1024) "Free Size (MB)", round (sum (fs. bytes) * 100/df. bytes) "% Free", round (df. bytes-sum (fs. bytes) * 100/df. bytes, 2) "% Used" from dba_free_space fs, (select tablespace_name, sum (bytes) bytes from dba_data_files group by tablespace_name) df where fs. tablespace_name = df. tablespace_namegroup by df. tablespace_name, df. bytes; 2. Total Size of all tablespaces select sum (bytes)/(1024*1024*1024) "Total Size (GB)" from dba_data_files; 3. select sum (bytes)/(1024*1024*1024) "Total Size (GB)" from dba_free_space; 4. Total Business tablespace size (Business tablespace here refers to a tablespace larger than 20 GB) select sum (df. bytes)/(1024*1024*1024) total from (select tablespace_name, sum (bytes) bytes from dba_data_files group by tablespace_name) df where (df. bytes/(1024*1024*1024)> 20; 5. select sum (fs. bytes) total from (select tablespace_name, sum (bytes)/(1024*1024*1024) bytes from dba_free_space group by tablespace_name) fs where fs. tablespace_name in (select tablespace_name from (select tablespace_name, sum (bytes) bytes from dba_data_files group by tablespace_name) df where (df. bytes/(1024*1024*1024)> 20 );

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.