UNDO 表空間——爲了保護數據的一致性而存儲數據舊的鏡像的表空間數據庫
當修改數據未提交的時候,修改的進程直接修改數據塊,這個數據庫塊的舊的鏡像被轉移到UNDO中存儲,此時沒有提交的時候爲了防止其餘用戶修改發生錯亂,這個行會被加鎖,若是查詢這個數據的話,發現有鎖,就直接到UNDO中去查詢數據的舊的鏡像。oracle
SQL> show parameter undoapp
NAME TYPE VALUE網站
------------------------------------ ----------- ------------------------------spa
undo_management string AUTO --UNDO的管理方式:AUTOblog
undo_retention integer 900 --undo數據在undo段中保留的最大時間爲900s進程
undo_tablespace string UNDOTBS1 --當前數據庫默認的undo表空間string
SQL> select name from v$datafile; (查看數據文件位置)io
NAMEtable
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/sztech1/system01.dbf
/u01/app/oracle/oradata/sztech1/sysaux01.dbf
/u01/app/oracle/oradata/sztech1/undotbs01.dbf
/u01/app/oracle/oradata/sztech1/users01.dbf
/u01/app/oracle/oradata/sztech1/example01.dbf
修改(切換)當前數據庫的UNDO表空間
一、建立一個新的UNDO 表空間
SQL> create undo tablespace undotbs2 datafile '/u01/app/oracle/oradata/sztech1/undo02.dbf' size 500M;
Tablespace created.
二、切換
SQL> alter system set undo_tablespace=undotbs2 scope=both;
System altered.
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS2
重慶思莊18年4月OCP認證培訓週末班正在授課,歡迎聯繫試聽!新的OCP週末班將於6月2日開課,火熱報名中,名額有限,請提早預約!更多詳情訪問思莊網站諮詢在線客服。