oracle temp 表空间

1.  查询空间的使用率,有用视图dba_temp_file,   v$temp_extent_pool。

select c.tablespace_name,       

       to_char(c.bytes / 1024 / 1024 / 1024, '99,999.999') total_gb,       

       to_char((c.bytes - d.bytes_used) / 1024 / 1024 / 1024, '99,999.999') free_gb,       

       to_char(d.bytes_used / 1024 / 1024 / 1024, '99,999.999') use_gb,       

       to_char(d.bytes_used * 100 / c.bytes, '99.99') || '%' use

  from (select tablespace_name, sum(bytes) bytes        

          from dba_temp_files

         GROUP by tablespace_name) c,       

       (select tablespace_name, sum(bytes_cached) bytes_used        

          from v$temp_extent_pool

         GROUP by tablespace_name) d

 where c.tablespace_name = d.tablespace_name;


2.   查看那些用户正在适用temp表空间,用到视图v$tempseg_usage,  v$temp_space_header

select a.username,       

       a.sql_id,       

       a.SEGTYPE,

       a.tablespace,       

       b.BYTES_USED / 1024 / 1024 / 1024,      

       b.BYTES_FREE / 1024 / 1024 / 1024

  from V$TEMPSEG_USAGE a  ,V$TEMP_SPACE_HEADER b 

  where a.TABLESPACE = b.tablespace_name 

  and a.tablespace='TEMP';


3. 根据查询到的sql_id值去查看那些session正在适用temp。



引用的连接:

http://blog.itpub.net/31547066/viewspace-2286048/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21374452/viewspace-2645056/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/21374452/viewspace-2645056/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值