Chinaunix

标题: Oracle表空间查询 [打印本页]

作者: gawk    时间: 2011-12-23 01:33
标题: Oracle表空间查询
select a.TABLESPACE_NAME,
 round(a.BYTES/1024/1024,2) mb_total ,
 round(b.BYTES/1024/1024,2) mb_free ,
 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
 )
 a,
 (
  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





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2