oracle 11g 解決臨時表空間佔滿問題

oracle 11g 清理臨時表空間


運維人員在查詢億級數據排序時,數據庫報錯,提示:ora-01652無法通過128(在表空間temp中)擴展temp段,排查流程如下:
1、查詢表空間使用率:

select * from (
Select a.tablespace_name,
to_char(a.bytes/1024/1024,'99,999.999') total_bytes,
to_char(b.bytes/1024/1024,'99,999.999') free_bytes,
to_char(a.bytes/1024/1024 - b.bytes/1024/1024,'99,999.999') use_bytes,
to_char((1 - b.bytes/a.bytes)*100,'99.99') || '%'use
from (select tablespace_name,
sum(bytes) bytes
from dba_data_files
group by tablespace_name) a,
(select tablespace_name,
sum(bytes) bytes
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name
union all
select c.tablespace_name,
to_char(c.bytes/1024/1024,'99,999.999') total_bytes,
to_char( (c.bytes-d.bytes_used)/1024/1024,'99,999.999') free_bytes,
to_char(d.bytes_used/1024/1024,'99,999.999') use_bytes,
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
)
order by tablespace_name

發現表空間使用率100%。
2、使用11g表空間收縮表空間,降低使用率,sql語句:ALTER  TABLESPACE  TEMP SHRINK  SPACE
3、查看到temp表空間大小變爲1.99M,使用率0%;
4、需添加臨時數據文件,設置大小,sql語句如下: alter tablespace temp add tempfile '/oracle/oradata/dbaxj/temp02.dbf' size 10240m autoextend on next 1024m maxsize 30G;
5、再次查看錶空間使用率如下圖:

降低到33%,問題解決

如果您覺得我的文章給了您幫助,請爲我買一杯飲料吧!以下是我的支付寶,意思一下我將非常感激!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章