oracle表空间分析,Oracle临时表空间使用分析

查询临时表空间的使用情况:

select * from (select a.tablespace_name,sum(maxbytes/1024/1024/1024) total_G,sum(a.bytes/1024/1024) allocated_mb

from dba_temp_files a

where a.tablespace_name=upper('XXX') group by a.tablespace_name) x,

(select sum(b.bytes_used/1024/1024) used_mb,

sum(b.bytes_free/1024/1024) free_mb

from v$temp_space_header b

where b.tablespace_name=upper('XXX') group by b.tablespace_name) y;

查询现有运行中占据临时表空间的SQL语句:

select se.sid,se.username,su.blocks*ts.block_size/1024/1024 mb_used,su.tablespace,

su.sqladdr address,sq.hash_value,sq.sql_text

from v$sort_usage su,v$session se,v$sqlarea sq,dba_tablespaces ts

where su.session_addr=se.saddr

and su.sqladdr=sq.address(+)

and su.tablespace=ts.tablespace_name;

查询会话汇总下,临时表空间的使用情况:

select se.sid,se.username,se.osuser,pr.spid,se.module,se.program,

sum(su.blocks)ts.block_size/1024/1024 mb_used,su.tablespace,

count() sorts

from v$sort_usage su,v$session se,dba_tablespaces ts,v$process pr

where su.session_addr=se.saddr

and se.paddr=pr.addr

and su.tablespace=ts.tablespace_name

group by se.sid,se.username,se.osuser,pr.spid,se.module,se.program,ts.block_size,su.tablespace;

---注意有时我们看到 unable to extend temp segment by 1024 in tablespace appdata;

不仔细以为是临时表空间不足,其实这里应该看appdata表空间大小

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值