Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Free space by tablespace script, quality control check.

Free space by tablespace script, quality control check.

From: Ethan Post <epost1_at_my-deja.com>
Date: 2000/06/27
Message-ID: <8jaqqn$mhe$1@nnrp1.deja.com>#1/1

This script reports current tablespace size, total space already allocated that it can grow in to, and total size the datafiles it's on can grow to, then total percentage used. I'm going to use some of these stats in a tool I'm building please let me know if you see any obvious problems with the logic.

Thanks,
Ethan
http://www.freetechnicaltraining.com
http://www.gnumetrics.com


select
tablespace_name,

round(sum(current_mb)) current_mb,
round(sum(total_mb)) total_mb,
round(sum(max_mb)) max_mb,
trunc(decode(sum(max_mb), 0, sum(current_mb)/sum(total_mb), sum

(current_mb)/sum(max_mb))*100) percentage
from
(

select
tablespace_name,
sum(bytes)/1024/1024 current_mb,
0 total_mb,
0 max_mb
from
dba_segments
group by
tablespace_name
union
select
tablespace_name,
0 current_mb,
sum(bytes)/1024/1024 total_mb,
sum(maxbytes)/1024/1024 max_mb
from
dba_data_files
group by
tablespace_name)
group by
tablespace_name

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Jun 27 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US