标签:format data- sql 字典 add decode shu lines scope
场景描述:
系统表空间空间不足,导致应用无法正常连接!!!
环境描述:
ORACLE 11G
查看当前表空间的整体使用情况,以及有没有开启自动扩展,以及扩展的最大限制!!!
---tablespace status 表空间使用情况
set pages 12222 lines 132
set serveroutput on size 1000000
col tablespace_name format a30
col autoextensible format a7
select a.tablespace_name,
round(a.s,2) "CURRENT_TOTAL(MB)",
round((a.s - f.s),2) "USED(MB)",
f.s "FREE(MB)",
round(f.s / a.s * 100, 2) "FREE%",
g.autoextensible,
round(a.ms,2) "MAX_TOTAL(MB)"
from (select d.tablespace_name,
sum(bytes / 1024 / 1024) s,
sum(decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024) ms
from dba_data_files d
group by d.tablespace_name) a,
(select f.tablespace_name, sum(f.bytes / 1024 / 1024) s
from dba_free_space f
group by f.tablespace_name) f,
(select distinct tablespace_name, autoextensible
from DBA_DATA_FILES
where autoextensible = ‘YES‘
union
select distinct tablespace_name, autoextensible
from DBA_DATA_FILES
where autoextensible = ‘NO‘
and tablespace_name not in
(select distinct tablespace_name
from DBA_DATA_FILES
where autoextensible = ‘YES‘)) g
where a.tablespace_name = f.tablespace_name
and g.tablespace_name = f.tablespace_name order by "FREE%";
标签:format data- sql 字典 add decode shu lines scope
原文地址:http://www.cnblogs.com/hellojesson/p/6958604.html