View the Oracle tablespace size and the remaining space size

Source: Internet
Author: User

Select f. tablespace_name,
A. total,
U. used,
F. free,
Round (u. used/a. total) * 100) "% USED ",
Round (f. free/a. total) * 100) "% FREE"
From (select tablespace_name, sum (bytes/(1024*1024) total
From dba_data_files
Group by tablespace_name),
(Select tablespace_name, round (sum (bytes/(1024*1024) used
From dba_extents
Group by tablespace_name) u,
(Select tablespace_name, round (sum (bytes/(1024*1024) free
From dba_free_space
Group by tablespace_name) f
Where a. tablespace_name = f. tablespace_name
And a. tablespace_name = u. tablespace_name;

 

The following method is faster:

Select a. tablespace_name,
A. bytes/1024/1024 "Sum MB ",
(A. bytes-B. bytes)/1024/1024 "used MB ",
B. bytes/1024/1024 "free MB ",
Round (a. bytes-B. bytes)/a. bytes) * 100, 2) "percent_used"
From (select tablespace_name, sum (bytes) bytes
From dba_data_files
Group by tablespace_name),
(Select tablespace_name, sum (bytes) bytes, max (bytes) largest
From dba_free_space
Group by tablespace_name) B
Where a. tablespace_name = B. tablespace_name
Order by (a. bytes-B. bytes)/a. bytes) desc;

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.