您好,登錄后才能下訂單哦!
本文小編為大家詳細介紹“Oracle本地UNDO模式怎么實現”,內容詳細,步驟清晰,細節處理妥當,希望這篇“Oracle本地UNDO模式怎么實現”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學習新知識吧。
SQL>COLUMN property_name FORMAT A30 SQL>COLUMN property_value FORMAT A30 SQL>SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUE
SELECT con_id, tablespace_name FROM cdb_tablespaces WHERE tablespace_name LIKE 'UNDO%' ORDER BY con_id; CON_ID TABLESPACE_NAME ---------- ------------------------------ 1 UNDOTBS1 3 UNDOTBS1
SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP UPGRADE; SQL> ALTER DATABASE LOCAL UNDO OFF; SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP;
SQL>COLUMN property_name FORMAT A30 SQL>COLUMN property_value FORMAT A30 SQL>SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ----------------------------- ------------------------------ LOCAL_UNDO_ENABLED FALSE
雖然已經不是本地undo模式了,但是之前存在的undo表空間不會自動刪除。如果礙事,要手動刪除。
SQL>SELECT con_id, tablespace_name FROM cdb_tablespaces WHERE tablespace_name LIKE 'UNDO%' ORDER BY con_id; CON_ID TABLESPACE_NAME ---------- ------------------------------ 1 UNDOTBS1 3 UNDOTBS1
–刪除多余的undo表空間
SQL>ALTER SESSION SET CONTAINER = pdb1; SQL>SELECT file_name FROM dba_data_files WHERE tablespace_name = 'UNDOTBS1'; ---------------------------------------------------------------------------------------------------- /u02/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf SQL>DROP TABLESPACE undotbs1; Tablespace dropped.
隨著所有老的undo表空間被移除了,現在該實例就是運行在共享undo模式上了。
利用上面的環境,重新切換回去。
可以看到是運行在共享undo模式上,而且只有一個undo表空間。
SQL>SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED FALSE SQL>SELECT con_id, tablespace_name FROM cdb_tablespaces WHERE tablespace_name LIKE 'UNDO%' ORDER BY con_id; CON_ID TABLESPACE_NAME ---------- ------------------------------ 1 UNDOTBS1
和切換為共享undo模式步驟相同。
SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP UPGRADE; SQL> ALTER DATABASE LOCAL UNDO ON; SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP;
SQL>COLUMN property_name FORMAT A30 SQL>COLUMN property_value FORMAT A30 SQL>SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED'; PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUE
–可以看到Oracle自動為PDB創建了一個undo表空間
SQL>SELECT con_id, tablespace_name FROM cdb_tablespaces WHERE tablespace_name LIKE 'UNDO%' ORDER BY con_id; CON_ID TABLESPACE_NAME ---------- ------------------------------ 1 UNDOTBS1 3 UNDO_1
可以看到新創建的數據庫也是運行在本地undo模式上。
SQL>CREATE PLUGGABLE DATABASE pdb2 ADMIN USER pdb_adm IDENTIFIED BY Password1; SQL>ALTER PLUGGABLE DATABASE pdb2 SAVE STATE; SQL>SELECT con_id, tablespace_name FROM cdb_tablespaces WHERE tablespace_name LIKE 'UNDO%' ORDER BY con_id; CON_ID TABLESPACE_NAME ---------- ------------------------------ 1 UNDOTBS1 3 UNDO_1 4 UNDOTBS1
讀到這里,這篇“Oracle本地UNDO模式怎么實現”文章已經介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領會,如果想了解更多相關內容的文章,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。