Question: What
does the v$filespace_usage view contain? Can you show
an example query using v$filespace_usage?
Answer: The v$filespace_usage view
is used to display file space usage. The
DBA_TABLESPACE_USAGE_METRICS, queries v$filespace_usage,
which keeps track of any MAXSIZE value may have set in
autoextended datafiles. See
percent used tablespaces.
Here is a sample query using v$filespace_usage:
select
t.name, sum(f.allocated_space),
sum(f.file_maxsize),
(sum(f.allocated_space)/sum(f.file_maxsize))*100
from
sys.ts$
t,
gv$filespace_usage f,
gv$parameter param
where
t.online$ != 3
and
t.bitmapped <> 0
and
f.inst_id = param.inst_id
and
param.name = 'undo_tablespace'
and
t.name = param.value
and
f.flag = 6
and
t.ts# = f.tablespace_id
group by
t.name,
f.tablespace_id,
t.ts#;
Here is yet another query example:
select
name,
round(total/1024/1024) "Total (MB)",
round(used/1024/1024)
"Used (MB)",
round((total-used)/1024/1024) "Free (MB)",
round(used/total*100)
"Usage (%)"
from
(
select
a.name,
sum(b.file_size * a.blocksize) total,
sum(b.allocated_space * a.blocksize) used
from
ts$ a,
v$filespace_usage
b
where
a.ts# =
b.tablespace_id(+)
and
a.contents$ = 0 -- exclude temp tablespaces
and
a.online$ < 3 -- exclude dropped tablespaces
group by a.name
union all
select
sh.tablespace_name,
sum(sh.bytes_used
+ sh.bytes_free) total_mb,
sum(sh.bytes_used)
used_mb
from v$temp_space_header sh
group by tablespace_name
)
order by
1;
References:
Bug 4203626 DBA_TABLESPACE_USAGE_METRICS /
V$FILESPACE_USAGE may be wrong
|
|
|
Oracle Training from Don Burleson
The best on site
"Oracle
training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

|
|
|

|
|
Burleson is the American Team

Note:
This Oracle
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
Oracle forum.
Verify
experience!
Anyone
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
publish
their Oracle
qualifications.
Errata?
Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
feedback. Just
e-mail:
and include the URL for the page.
Copyright © 1996 - 2020
All rights reserved by
Burleson
Oracle ®
is the registered trademark of Oracle Corporation.
|
|