Oracle釋放undo資料表空間

來源:互聯網
上載者:User

  在日常的資料庫維護和資料庫編程中經常會遇到猶豫對大資料量做DML操作後是得Oracle的undo資料表空間擴充到十幾個G或者幾十個G 但是這些資料表空間的所佔用磁碟的物理空間又不會被Oracle所釋放,如果你用的是PC機很可能會遇到磁碟空間不足的問題,經過個人整理經過如下操作可以重構undo資料表空間,同樣temp資料表空間也可能在你查詢大資料或則建立索引的時候無限擴大導致磁碟空間不足,同樣可以用如下方式解決此問題:

  --查看各資料表空間名稱

  select name from v$tablespace

  --查看某個資料表空間資訊

  select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'UNDOTBS1';

  --查看復原段的使用方式,哪個使用者正在使用復原段的資源,如果有使用者最好更換時間(特別是生產環境)。

  select s.username, u.name from v$transaction t,v$rollstat r, v$rollname u,v$session s

  where s.taddr=t.addr and  t.xidusn=r.usn and r.usn=u.usn order by s.username;

  --檢查UNDO Segment狀態

  select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks from v$rollstat order by rssize;

  --建立新的UNDO資料表空間,並設定自動擴充參數;

  create undo tablespace undotbs2 datafile 'D:\Oracle\PRODUCT\10.1.0\ORADATA\ORCL\UNDOTBS02.DBF' size 10m reuse autoextend on next 100m maxsize unlimited;

  • 1
  • 2
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.