View oracle table space and usage

SELECT a.tablespace_name "table space", 
       Total "table space", 
       Free "tablespace remaining size", 
       (Total - Free) "tablespace size", 
       Total / (1024 * 1024 * 1024) "Table space (G) ", 
       Free / (1024 * 1024 * 1024)" table space remaining size (G) ", 
       (Total - Free) / (1024 * 1024 * 1024)" tablespace size (G) ", 
       round (( total - free) / total, 4 ) * 100 " usage%" 
  the FROM (the SELECT tablespace_name, the SUM (bytes) Free 
          the FROM DBA_FREE_SPACE 
         the GROUP BY tablespace_name) A, 
       (the SELECT tablespace_name, the SUM (bytes) Total 
          the FROM dba_data_files 
         the GROUP BY tablespace_name) B 
 WHERE a.tablespace_name = b.tablespace_name

  Note: Users need to have dba privileges, otherwise it will report an error can not be found.

 

Reference: http: //blog.itpub.net/31477110/viewspace-2152749/

          https://www.cnblogs.com/lipera/p/6201434.html

Guess you like

Origin www.cnblogs.com/anningkang/p/11548112.html