脚本:监控临时表空间使用率

针对字典管理临时表空间:

select (s.tot_used_blocks/f.total_blocks)*100 as "percent used" from 
(select sum(used_blocks) tot_used_blocks from v$sort_segment where tablespace_name='TEMP') s, 
(select sum(blocks) total_blocks from dba_data_files where tablespace_name='TEMP') f;

针对本地管理表空间:

select (s.tot_used_blocks/f.total_blocks)*100 as "percent used" from 
(select sum(used_blocks) tot_used_blocks from v$sort_segment where tablespace_name='TEMP') s, 
(select sum(blocks) total_blocks from dba_temp_files where tablespace_name='TEMP') f;

示例输出:

 select (s.tot_used_blocks/f.total_blocks)*100 as "percent used"
  2  from (select sum(used_blocks) tot_used_blocks from 
v$sort_segment where tablespace_name='TEMP') s, 
(select sum(blocks) total_blocks from dba_temp_files where tablespace_name='TEMP') f;

percent used
------------
           0

沪ICP备14014813号

沪公网安备 31010802001379号