Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> sql question
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