DBA_FREE_SPACE视图记录了数据库中所有表空间的自由extents情况,所以可以从该视图获得各表空间自由空间情况。
SQL desc dba_free_space
Name Null?Type
----------------------- ------------- -----------------
TABLESPACE_NAME VARCHAR2(30)
FILE_ID NUMBER
BLOCK_IDNUMBER
BYTES NUMBER
BLOCKSNUMBER
RELATIVE_FNONUMBER
可以使用如下SQL进行查询:
select tablespace_name,sum(bytes)/1024/1024 free_Mbytes
from dba_free_space
group by tablespace_name
order by free_Mbytes
/
示例输出:
SQL select tablespace_name,sum(bytes)/1024/1024 free_Mbytes
2from dba_free_space
3group by tablespace_name
4order by free_Mbytes
5/
TABLESPACE_NAMEFREE_MBYTES
-------------------- -----------
USERS.75
UNDOTBS1 18.6875
SYSTEM 42.6875