UNDO 表空間重建(清理)

2021-06-12 01:15:38 字數 1399 閱讀 9737

oracle的aum(auto undo management)從出生以來就經常出現只擴充套件,不收縮(shrink)的情況(通常我們可以設定足夠的undo表空間大小,然後取消其自動擴充套件屬性).

檢視表空間使用情況

select   a.tablespace_name,round (a.total_size) "total_size(mb)",round (a.total_size) - round (b.free_size, 3) "used_size(mb)",round (b.free_size, 3) "free_size(mb)",round (b.free_size / total_size * 100, 2) || '%' free_rate  from   (  select   tablespace_name, sum (bytes) / 1024 / 1024 total_size from   dba_data_files group by   tablespace_name) a, (  select   tablespace_name, sum (bytes) / 1024 / 1024 free_size from   dba_free_space group by   tablespace_name) b where   a.tablespace_name = b.tablespace_name(+);

現在我們可以採用如下步驟**undo空間:

1.確認檔案

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

2.檢查undo segment狀態

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

3.建立新的undo表空間

tablespace created.

4.切換undo表空間為新的undo表空間

sql> alter system set undo_tablespace=undotbs3;

system altered.

5.等待原undo表空間所有undo segment offline 

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

6.刪除原undo表空間

alter tablespace undotbs1 offline

drop tablespace undotbs1 including contents and datafiles;

7.檢查空間情況

日後增加資料檔案方法

重建Undo表空間

檢視各表空間名稱 select name from v tablespace 檢視某個表空間資訊 select file name,bytes 1024 1024 from dba data files where tablespace name like undotbs1 檢視回滾段的使用情況,哪...

UNDO表空間清理(切換)

檢視表空間使用情況 select a.tablespace name 表空間名 total 表空間大小 free 表空間剩餘大小 total free 表空間使用大小 total 1024 1024 1024 表空間大小 g free 1024 1024 1024 表空間剩餘大小 g total f...

undo表空間損壞

操作如下 sqlplus as sysdba 繼續執行命令 alter database open 例項終止。強制斷開連線 recover database recover datafile 1 recover datafile 2 系統提示 介質恢復成功 以為恢復成功就,直接,startup fo...