How the Database Views table space usage

Source: Internet
Author: User

Enter the Oracle database and enter the following code to
Select Total.tablespace_name,
Round (total. MB, 2) as TOTAL_MB,
Round (total. Mb-free. MB, 2) as USED_MB,
Round (1-free. Mb/total. MB) 100, 2) | | '% ' as used_pct
From (select Tablespace_name, sum (bytes)/1024/1024 as MB
From Dba_free_space
Group by Tablespace_name) free,
(select Tablespace_name, sum (bytes)/1024/1024 as MB
From Dba_data_files
Group BY Tablespace_name) total
where free.tablespace_name = Total.tablespace_name;

Select A.tablespace_name, A.bytes total, A.bytes-nvl (b.bytes, 0) free from (SELECT tablespace_name, SUM (BYTES) BYTES FR OM dba_temp_files GROUP by Tablespace_name) A, (SELECT tablespace_name, SUM (bytes_cached) bytes from V$temp_extent_pool GR OUP by Tablespace_name) b WHERE a.tablespace_name = B.tablespace_name (+)

Select Temp_used.tablespace_name,total-used as "free", total as "total", round (NVL (total-used, 0)
100/total, 3) "Free percent" from (select Tablespace_name, SUM (bytes used)/1024/1024 used from GV$TEMP _space_header GROUP by Tablespace_name) temp_used, (SELECT tablespace_name, SUM (bytes)/1024/1024 total from Dba_te Mp_files GROUP by Tablespace_name) temp_total WHERE temp_used.tablespace_name = temp_total.tablespace_name;

Those statements to use temporary table space
SELECT se.username,sid,serial#,sql_address,machine,program,tablespace,segtype,contents from V$session SE, V$sort_ Usage su WHERE se.saddr = su.session_addr;

How the Database Views table space usage

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.