加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle临时表空间使用分析

发布时间:2020-12-12 13:36:56 所属栏目:百科 来源:网络整理
导读:查询临时表空间的使用情况: 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
查询临时表空间的使用情况:

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.osuser,pr.spid,se.module,se.program,
sum(su.blocks)ts.block_size/1024/1024 mb_used,
count(
) sorts
from v$sort_usage su,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,ts.block_size,su.tablespace;

---注意有时我们看到 unable to extend temp segment by 1024 in tablespace appdata;不仔细以为是临时表空间不足,其实这里应该看appdata表空间大小

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读