ITPub博客

首页 > 数据库 > Oracle > oracle temp 表空间

oracle temp 表空间

原创 Oracle 作者:kakaxi9521 时间:2019-05-21 14:14:00 1 删除 编辑

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博客 ” ,链接:https://blog.itpub.net/21374452/viewspace-2645056/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 离线安装docker
请登录后发表评论 登录
全部评论

注册时间:2009-04-13

  • 博文量
    136
  • 访问量
    179047