天天看點

表空間統計

方法1:

select ff.s tablespace_name,

ff.b total,

(ff.b - fr.b) usage,

fr.b free,

round((ff.b - fr.b) / ff.b * 100) || '% ' usagep

from (select tablespace_name s, sum(bytes) / 1024 / 1024 b

from dba_data_files

group by tablespace_name) ff,

(select tablespace_name s, sum(bytes) / 1024 / 1024 b

from dba_free_space

group by tablespace_name) fr

where ff.s = fr.s

方法2:

select a.owner,a.segment_name,segment_type,sum(bytes)/1024 as SizeM From dba_segments a

inner join (

select owner,segment_name from dba_lobs where table_name ='XI_AF_MSG' union all

select owner,index_name as segment_name from dba_indexes where table_name ='XI_AF_MSG' union all

select owner,segment_name from dba_segments where segment_name='XI_AF_MSG'

) b on a.owner=b.owner and a.segment_name=b.segment_name

group by a.owner,a.segment_name,segment_type

order by a.segment_name