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

Home -> Community -> Usenet -> c.d.o.misc -> sql question

sql question

From: <kshave_at_health.gov.mb.ca>
Date: Wed, 10 Nov 1999 18:48:29 GMT
Message-ID: <80cels$8ra$1@nnrp1.deja.com>


I want to determine how much space is currently allocated for each tablespace, as well as how much is free, and the percentage free. Here is my query ...

select a.tablespace_name, sum(a.bytes/(1024*1024)) "MB Alloc", trunc(sum(b.bytes/(1024*1024)),3) "MB Free", trunc((sum(b.bytes)/sum(a.bytes))*100,1) "% Free" from dba_data_files a, dba_free_space b where a.tablespace_name = b.tablespace_name group by a.tablespace_name

This, however, does not work properly because there are multiple entries of each tablespace in each of the two tables. The sum is being performed twice because the tablespace I'm testing with exists in each table twice. How can I get around this?

--
-Keith

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Nov 10 1999 - 12:48:29 CST

Original text of this message

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