2016-03-09 回答

查看“oracle”临时表空间当前使用了多少空间,可按照以下程序。

select d.tablespace_name "name", d.status "status",

to_char (nvl (a.bytes / 1024 / 1024, 0), '99,999,990.90') "size (m)",

to_char (nvl (a.bytes - nvl (f.bytes, 0), 0) / 1024 / 1024,

'99999999.99'

) use,

to_char (nvl ((a.bytes - nvl (f.bytes, 0)) / a.bytes * 100, 0),

'990.00'

) "used %"

from sys.dba_tablespaces d,

(select   tablespace_name, sum (bytes) bytes

from dba_data_files

group by tablespace_name) a,

(select   tablespace_name, sum (bytes) bytes

from dba_free_space

group by tablespace_name) f

where d.tablespace_name = a.tablespace_name(+)

and d.tablespace_name = f.tablespace_name(+)

and not (d.extent_management like 'local' and d.contents like 'temporary')

union all

select d.tablespace_name "name", d.status "status",

to_char (nvl (a.bytes / 1024 / 1024, 0), '99,999,990.90') "size (m)",

to_char (nvl (t.bytes, 0) / 1024 / 1024, '99999999.99') use,

to_char (nvl (t.bytes / a.bytes * 100, 0), '990.00') "used %"

from sys.dba_tablespaces d,

(select   tablespace_name, sum (bytes) bytes

from dba_temp_files

group by tablespace_name) a,

(select   tablespace_name, sum (bytes_cached) bytes

from v$temp_extent_pool

group by tablespace_name) t

where d.tablespace_name = a.tablespace_name(+)

and d.tablespace_name = t.tablespace_name(+)

and d.extent_management like 'local'

and d.contents like 'temporary';

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐