【UNDO】使用重建UNDO表空間方法解決UNDO表空間過大問題
經過之前的大資料量測試,目前系統中的undo表空間被撐大到近20G。釋放其佔用的空間的工作擺在案頭。透過此文將此項維護工作做一個簡單梳理,供大家參考。
思路很簡單,就是透過啟用一個新的undo表空間,然後刪除原有表空間的方式來完成。
1.查詢當前的undo表空間的大小,及系統可用空間大小
sys@ora10g> col file_name for a40
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undotbs01.dbf 19870 UNDOTBS1
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 196G 27G 89% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
2.建立一個新undo表空間
sys@ora10g> create undo tablespace UNDO_TBS1 datafile '/oracle/oradata/ora10g/undo_tbs01.dbf' size 100m;
Tablespace created.
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undotbs01.dbf 19870 UNDOTBS1
/oracle/oradata/ora10g/undo_tbs01.dbf 100 UNDO_TBS1
3.將預設的undo表空間設定調整到UNDO_TBS1
sys@ora10g> alter system set undo_tablespace=UNDO_TBS1;
System altered.
4.刪除原有的undo表空間
sys@ora10g> !ls -l /oracle/oradata/ora10g/undotbs01.dbf
-rw-r----- 1 oracle oinstall 20835213312 Nov 23 17:10 /oracle/oradata/ora10g/undotbs01.dbf
sys@ora10g> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
sys@ora10g> !ls -l /oracle/oradata/ora10g/undotbs01.dbf
ls: /oracle/oradata/ora10g/undotbs01.dbf: No such file or directory
5.最後確認一下undo表空間的設定情況
sys@ora10g> col file_name for a40
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undo_tbs01.dbf 100 UNDO_TBS1
sys@ora10g> show parameter undo_tablespace
NAME TYPE VALUE
------------------- ------------- -------------------
undo_tablespace string UNDO_TBS1
6.如果不想等待N長時間才看到被釋放出來的空間,此時需要重新啟動一下資料庫。
1)檢視此時的系統可用空間,結論是被釋放的空間沒有歸還給作業系統
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 196G 27G 89% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
2)重新啟動資料庫
sys@ora10g> startup force;
ORACLE instance started.
Total System Global Area 5368709120 bytes
Fixed Size 2080320 bytes
Variable Size 905970112 bytes
Database Buffers 4445962240 bytes
Redo Buffers 14696448 bytes
Database mounted.
Database opened.
3)在此確認,此時空間已經可以被成功釋放
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 177G 46G 80% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
7.小結
使用上面的方法可以釋放過分增長的undo表空間,但是根本上的解決方法是防止這種現象的發生。可以考慮採用限制undo表空間最大值的方法來緩解此類事件的發生。
sys@ora10g> alter database datafile '/oracle/oradata/ora10g/undotbs01.dbf' autoextend on next 10m maxsize 1g;
Database altered.
Good luck.
secooler
09.11.23
-- The End --
思路很簡單,就是透過啟用一個新的undo表空間,然後刪除原有表空間的方式來完成。
1.查詢當前的undo表空間的大小,及系統可用空間大小
sys@ora10g> col file_name for a40
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undotbs01.dbf 19870 UNDOTBS1
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 196G 27G 89% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
2.建立一個新undo表空間
sys@ora10g> create undo tablespace UNDO_TBS1 datafile '/oracle/oradata/ora10g/undo_tbs01.dbf' size 100m;
Tablespace created.
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undotbs01.dbf 19870 UNDOTBS1
/oracle/oradata/ora10g/undo_tbs01.dbf 100 UNDO_TBS1
3.將預設的undo表空間設定調整到UNDO_TBS1
sys@ora10g> alter system set undo_tablespace=UNDO_TBS1;
System altered.
4.刪除原有的undo表空間
sys@ora10g> !ls -l /oracle/oradata/ora10g/undotbs01.dbf
-rw-r----- 1 oracle oinstall 20835213312 Nov 23 17:10 /oracle/oradata/ora10g/undotbs01.dbf
sys@ora10g> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
sys@ora10g> !ls -l /oracle/oradata/ora10g/undotbs01.dbf
ls: /oracle/oradata/ora10g/undotbs01.dbf: No such file or directory
5.最後確認一下undo表空間的設定情況
sys@ora10g> col file_name for a40
sys@ora10g> select file_name,bytes/1024/1024 MB,tablespace_name from dba_data_files where tablespace_name like 'UNDO%';
FILE_NAME MB TABLESPACE_NAME
---------------------------------------- ---------- ------------------
/oracle/oradata/ora10g/undo_tbs01.dbf 100 UNDO_TBS1
sys@ora10g> show parameter undo_tablespace
NAME TYPE VALUE
------------------- ------------- -------------------
undo_tablespace string UNDO_TBS1
6.如果不想等待N長時間才看到被釋放出來的空間,此時需要重新啟動一下資料庫。
1)檢視此時的系統可用空間,結論是被釋放的空間沒有歸還給作業系統
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 196G 27G 89% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
2)重新啟動資料庫
sys@ora10g> startup force;
ORACLE instance started.
Total System Global Area 5368709120 bytes
Fixed Size 2080320 bytes
Variable Size 905970112 bytes
Database Buffers 4445962240 bytes
Redo Buffers 14696448 bytes
Database mounted.
Database opened.
3)在此確認,此時空間已經可以被成功釋放
sys@ora10g> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
234G 177G 46G 80% /
/dev/cciss/c0d0p1 99M 13M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
7.小結
使用上面的方法可以釋放過分增長的undo表空間,但是根本上的解決方法是防止這種現象的發生。可以考慮採用限制undo表空間最大值的方法來緩解此類事件的發生。
sys@ora10g> alter database datafile '/oracle/oradata/ora10g/undotbs01.dbf' autoextend on next 10m maxsize 1g;
Database altered.
Good luck.
secooler
09.11.23
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-620336/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- undo表空間使用率過高解決
- undo表空間容量
- 2.5.5 使用自動Undo管理: 建立 Undo 表空間
- Innodb:Undo 表空間巨大
- 更改undo表空間大小
- UNDO表空間空間回收及切換
- MySQL InnoDB Undo表空間配置MySql
- 【UNDO】Oracle undo表空間使用率過高,因為一個查詢Oracle
- 18_深入解析Oracle undo原理(2)_undo表空間使用率100%問題處理Oracle
- ORACLE線上切換undo表空間Oracle
- oracle中undo表空間丟失處理方法Oracle
- Oracle切換undo表空間操作步驟Oracle
- MySQL UNDO表空間獨立和截斷MySql
- [20210527]rman與undo表空間備份.txt
- 刪除UNDO表空間並處理ORA-01548問題
- undo表空間使用率100%的原因檢視
- 檢查及設定合理的undo表空間
- 2.6.8 設定UNDO空間管理方法
- MySQL 5.7新特性之線上收縮undo表空間MySql
- Oracle 19c 線上縮減 UNDO 表空間 容量Oracle
- 12C關於CDB、PDB 回滾undo表空間的總結
- oracle系統表空間過大問題處理Oracle
- 臨時表空間ORA-1652問題解決
- 16、表空間 建立表空間
- 28、undo_1_2(undo引數、undo段、事務)
- 當使用者無限制使用表空間配額且表空間有足夠空間時出現超出表空間的空間限額
- [20210528]oracle大表空間預分配問題.txtOracle
- Innodb undo之 undo結構簡析
- Oracle undo 表空間資料檔案丟失強制啟動資料庫(沒有未提交的事務)Oracle資料庫
- Postgresql表空間詳解SQL
- MySQL undoMySql
- 臨時表空間使用率過高的解決辦法
- 臨時表空間和回滾表空間使用率查詢
- Oracle表空間Oracle
- oracle 表空間Oracle
- PostgreSQL 表空間SQL
- PostgreSQL:表空間SQL
- 表空間利用率及表空間的補充
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle