Querying database table Spaces

Source: Internet
Author: User

Select df.tablespace_name,       round (df.total_space /  1048576, 0)   "Total space (MB)",        round (df.total_space &NBSP;-&NBSP;NVL (fs.free_space, 0))  / 1048576, 0)   "Used space (MB)",        round (NVL (fs.free_space, 0)  / 1048576, 0)   "Free  Space (MB),        round (100 *  (1&NBSP;-&NBSP;NVL (Fs.free_space,  0) ( / df.total_space),  2)   "%used",        to_char ( sysdate,  ' Yyyy-mm-dd hh24:mi ')  Stat_Time  from  (Select tablespace_name,  sum (bytes)  total_space          from dba_ Data_files         group by tablespace_name) &NBSP;DF,         (Select b.tablespace_name, sum (b.bytes)  free_space           from dba_free_space b          group by b.tablespace_name)  fs where df.tablespace_name =  Fs.tablespace_name (+)    and exists  (select *           from dba_tablespaces ts          where ts.contents <>  ' temporary '             and ts.tablespace_name = df.tablespace_name) Unionselect df.tablespace_ Name,       round (df.total_space / 1048576, 0)   "Total  space (MB) ",        round (NVL (us.used_space, 0)  /  1048576, 0)   "Used space (MB)",       round ((DF.TOTAL_SPACE&NBSP;-&NBSP;NVL (us.used_space, 0))  /  1048576, 0)   "Free space (MB)",        round (100 *   (NVL (us.used_space, 0)  / df.total_space),  2)   "%used",        to_char (sysdate,  ' Yyyy-mm-dd hh24:mi ')  Stat_Time  from  (select  tablespace_name, sum (bytes)  total_space           from dba_temp_files         group by  Tablespace_name)  df,        (Select b.tablespace_name, sum ( b.bytes_cached)  used_space          from v$temp_ Extent_pool b         group by b.tablespace_name)  us where df. Tablespace_name = us.tablespace_name (+)    and exists  (select *           from dba_tablespaces ts          where ts.contents =  ' temporary '             and ts.tablespace_name = df.tablespace_name)   order by 5 desc;!


This article is from the "Beijing-East" blog, please be sure to keep this source http://bjdong.blog.51cto.com/507460/1718632

Querying database table Spaces

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.