射精一区欧美专区|国产精品66xx|亚洲视频一区导航|日韩欧美人妻精品中文|超碰婷婷xxnx|日韩无码综合激情|特级黄片一区二区|四虎日韩成人A√|久久精品内谢片|亚洲成a人无码电影

您現(xiàn)在的位置:首頁 > IT認證 > oracle認證 >

Oracle臨時表空間過大問題解決


  查詢數(shù)據(jù)庫服務器時,發(fā)現(xiàn)數(shù)據(jù)庫服務器磁盤使用空間達到了98%,分析總共的數(shù)據(jù)文件也不可能達到如此大,經(jīng)過查詢發(fā)現(xiàn)原來臨時表空間的使用情況達到了 32G,導致磁盤空間使用緊張。搜索了相應的文檔與資料后,查出臨時表空間主要使用在:
  - 索引創(chuàng)建或重創(chuàng)建。
  - ORDER BY or GROUP BY (這個是‘罪魁禍首’)
  - DISTINCT 操作。
  - UNION & INTERSECT & MINUS - Sort-Merge joins. - Analyze 操作
  - 有些異常將會引起temp暴漲(這個也很有可能)
  下面是重新創(chuàng)建一個臨時表空間,把原來的默認臨時表空間drop掉(包括里面的臨時數(shù)據(jù)文件)再重新建立
  SQL> create temporary tablespace temp2
  2 tempfile '/home/oracle/oracle/product/10.2.0/oradata/hatest/temp02.pdf' size 512M reuse
  3 autoextend on next 640k maxsize unlimited;
  Tablespace created.
  SQL> alter database default temporary tablespace temp2;
  Database altered.
  SQL> drop tablespace temp including contents and datafiles;
  Tablespace dropped.
 。ㄗ⒁猓河捎谂R時表空間的數(shù)據(jù)文件比較大,所以這步可能會花費比較長的時間)
  SQL> create temporary tablespace temp
  2 tempfile '/home/oracle/oracle/product/10.2.0/oradata/hatest/temp01.pdf' size 512M reuse
  3 autoextend on next 640K maxsize unlimited;
  Tablespace created.
  SQL> alter database default temporary tablespace temp;
  Database altered.
  SQL> drop tablespace temp2 including contents and datafiles;
  Tablespace dropped.
  SQL> exit
  以上的方法只是暫時釋放了臨時表空間的磁盤占用空間,是治標但不是治本的方法,真正的治本的方法是找出數(shù)據(jù)庫中消耗資源比較大的sql語句,然后對其進行優(yōu)化處理。下面是查詢在sort排序區(qū)使用的執(zhí)行耗時的SQL
  Select se.username,se.sid,su.extents,su.blocks*to_number(rtrim(p.value))as Space,tablespace,segtype,sql_text
  from v$sort_usage su,v$parameter p,v$session se,v$sql s
  where p.name='db_block_size' and su.session_addr=se.saddr and s.hash_value=su.sqlhash and s.address=su.sqladdr
  order by se.username,se.sid

相關(guān)文章

無相關(guān)信息
更新時間2022-03-13 10:53:46【至頂部↑】
聯(lián)系我們 | 郵件: | 客服熱線電話:4008816886(QQ同號) | 

付款方式留言簿投訴中心網(wǎng)站糾錯二維碼手機版

客服電話: