查询11g表空间使用率:
set linesize 200 pagesize 999
col tablespace_name for a30
col file_name for a65
select name inst_name, b.tablespace_name ,
ROUND(b.total/1024/1024/1024 ,4) total_GB ,
ROUND(b.maxtotal/1024/1024/1024,4) maxtotal_GB,
ROUND(a.free/1024/1024/1024,4) free_GB,
ROUND((b.total-a.free)/1024/1024/1024 ,4) used_GB,
ROUND((b.total-a.free)/b.maxtotal,5)*100 Used_Pct
from
( select tablespace_name,SUM(bytes) free from DBA_FREE_SPACE group by tablespace_name ) a,
(select tablespace_name,SUM(bytes) total,sum( case maxbytes when 0 then bytes else maxbytes end) maxtotal
from dba_data_files group by tablespace_name ) b , v$database
where b.tablespace_name=a.tablespace_name
and b.tablespace_name not like '%UNDO%'
order by Used_Pct desc ;
查询表空间是否自动扩展:
select file_name ,autoextensible ,increment_by from dba_data_files ;