Jump to content
Alexandre Garcia

espaço total gasto pelos segmentos

Recommended Posts

Pessoal fiz da forma abaixo mas a saida nao está correta ainda o percentual está errado.

 

SELECT owner, 
 data_mb, 
 indx_mb, 
 lob_mb, 
 total_mb,
 ratio_to_report(total_mb) over () AS RR
 FROM (SELECT data.owner, 
 NVL(data_mb,0) data_mb, 
 NVL(indx_mb,0) indx_mb, 
 NVL(lob_mb,0) lob_mb, 
 NVL(data_mb,0) + NVL(indx_mb,0) + NVL(lob_mb,0) total_mb 
 FROM ( SELECT owner, 
 ROUND(SUM(data_mb),2) data_mb 
 FROM (SELECT owner, data_mb 
 FROM (SELECT a.owner, 
 b.bytes/1024/1024 AS data_mb 
 FROM dba_tables a, dba_segments b 
 WHERE a.owner = b.owner and a.table_name = b.segment_name)) 
 GROUP BY owner) data, 
 ( SELECT a.owner, 
 ROUND(SUM(b.bytes/1024/1024),2) AS indx_mb 
 FROM dba_indexes a, dba_segments b 
 WHERE a.owner = b.owner and a.index_name = b.segment_name 
 GROUP BY a.owner) indx, 
 ( SELECT a.owner, 
 ROUND(SUM(b.bytes/1024/1024),2) AS lob_mb 
 FROM dba_lobs a, dba_segments b 
 WHERE a.owner = b.owner and a.segment_name = b.segment_name 
 GROUP BY a.owner) lob 
 WHERE 
 data.owner = indx.owner(+) 
 AND data.owner = lob.owner(+)) 
 WHERE owner in ('LOCADORA','MEUESQUEMA') 
 ORDER BY owner;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.