Unplugging, Plugging, and Upgrading a PDB to a New

一 從早期版本CDB拔出早期版本PDB
一、在PDB上運行升級前信息工具。
例如,salespdbCDB中運行的名爲PDB 的位置$ORACLE_HOME_12.2:java

$ORACLE_BASE/product/12.1.0/dbhome_1/jdk/bin/java -jar  /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/admin/preupgrade.jar dir /tmp -c salespdb

Unplugging, Plugging, and Upgrading a PDB to a New
二、preupgrade_fixups.sql在您的源數據庫上運行
例如:sql

CONNECT / AS SYSDBA
SQL> ALTER SESSION SET CONTAINER=salespdb;
SQL> @/tmp/preupgrade_fixups.sql

三、遵循中列出的全部建議preupgrade.log
Unplugging, Plugging, and Upgrading a PDB to a New
四、Oracle APEX
在12.1.0.2.0中默認安裝,而在12.2.0.1.0未默認安裝,若是不進行APEX卸載,在12.2.0.1.0中plug 12.1.0.2.0版本的pdb將報以下ORA-65346錯誤:
Unplugging, Plugging, and Upgrading a PDB to a New
固然,若是您有使用到APEX,須要在12.2.0.1.0中安裝APEX,而無需卸載12.1.0.2.0中的APEX。
卸載方式:shell

SQL> select COMP_ID, STATUS from DBA_REGISTRY where COMP_ID='APEX'; 

COMP_ID                        STATUS
------------------------------ ----------------------
APEX                           VALID
$ cd $ORACLE_HOME/apex
$ sqlplus / as sysdba
SQL>@apxremov_con.sql

Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
五、關閉要拔出的PDB
例如,使用如下命令關閉PDB salespdb:數據庫

SQL> ALTER PLUGGABLE DATABASE salespdb CLOSE;

六、從新登陸到CDB$ROOT:oracle

CONNECT / AS SYSDBA
SQL> ALTER SESSION SET CONTAINER=CDB$ROOT;

七、 使用如下SQL命令語法拔出早期版本的PDB,其中pdbPDB的名稱和pathPDB XML文件的位置:app

ALTER PLUGGABLE DATABASE salespdb UNPLUG INTO '/home/oracle/salespdb.xml';

命令完成後,將顯示如下響應:
Unplugging, Plugging, and Upgrading a PDB to a New
八、刪除可插入數據庫salespdb,但保留數據文件。
Oracle建議您執行salespdb此過程後清除CDB視圖中的剩餘信息,並避免未來出現問題。做爲最佳實踐指南,請首先將PDB備份到目標CDB中,而後DROP在源上發出命令。
要刪除可插入數據庫,請輸入如下命令:ide

SQL> DROP PLUGGABLE DATABASE salespdb KEEP DATAFILES;

Unplugging, Plugging, and Upgrading a PDB to a New
二 將早期版本的PDB插入更高版本的CDB
一、拷貝xml與數據文件
Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
要將PDB從較早版本的CDB插入到較早版本的CDB,請使用如下CREATE PLUGGABLE DATABASE命令。
此過程示例說明了在使用Oracle管理的文件時如何插入PDB。有關插入PDB的更多信息,請參考《Oracle數據庫管理員指南》。
鏈接到更高版本的CDB。使用如下SQL命令插入早期版本的PDB,其中pdbPDB path是PDB的名稱,也是PDB XML文件所在的路徑:
二、建立pdb工具

CREATE PLUGGABLE DATABASE salespdb USING '/home/oracle/salespdb.xml' SOURCE_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/orcl/salespdb','/u01/app/oracle/oradata/ORCL/salespdb') nocopy tempfile reuse;

因爲APEX致使
Unplugging, Plugging, and Upgrading a PDB to a New
解決方式:因爲在unplugging 時沒有卸載APEX,後續可刪除xml文件中的
Unplugging, Plugging, and Upgrading a PDB to a New
不事後續會報不少錯誤。
命令完成後,將顯示如下響應:
Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
三 將早期版本的PDB升級到更高版本
在UPGRADE模式下打開的PDB 使用Parallel Upgrade Utility來將較早發行的PDB升級到CDB的發行級別。
一、切換到升級PDB
例如,輸入如下命令以切換到PDB salespdb:post

SQL> ALTER SESSION SET CONTAINER=salespdb;

二、在升級模式下打開PDB。日誌

SQL> ALTER PLUGGABLE DATABASE OPEN UPGRADE;

Unplugging, Plugging, and Upgrading a PDB to a New
三、使用「並行升級實用程序」命令(catctl.pl或shell實用程序dbupgrade)升級PDB 。
升級PDB時,請使用一般與Parallel Upgrade Utility並行使用的命令。可是,您還能夠添加選項以指定要升級的PDB。如如下示例所示,使用名爲的PDB大寫PDB的名稱: -c PDBnamesalespdb

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl -d  \
$ORACLE_HOME/rdbms/admin -c 'salespdb' -l $ORACLE_BASE catupgrd.sql

Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
Unplugging, Plugging, and Upgrading a PDB to a New
四、查看結果
日誌的默認文件路徑在path中,其中Oracle基本路徑,數據庫名稱以及升級的日期和時間。日期和時間字符串採用字符串格式YYYY MM DD HH MM SC,其中YYYY表示年,MM表示月,DD表示日,HH表示小時,MM表示分鐘,SC表示秒。 Oracle_base/cfgtoollogs/dbname/upgradedatetimeOracle_basedbnameupgradedatetime例如:
Unplugging, Plugging, and Upgrading a PDB to a New
五、登陸到SQL * Plus,而後打開PDB以執行升級後的修訂,並從新編譯INVALID數據庫中的對象:

SQL> STARTUP;
SQL> ALTER SESSION SET CONTAINER=salespdb;

六、使用該實用程序catcon.pl運行腳本postupgrade_fixups.sql:

@/tmp/postupgrade_fixups.sql

七、使用該實用程序從目錄catcon.pl運行:

@$ORACLE_HOME/rdbms/admin/utlrp.sql

該腳本將從新編譯INVALID數據庫中的對象,並將名稱爲的日誌文件放置在當前目錄中comp0.log。
Unplugging, Plugging, and Upgrading a PDB to a New

Unplugging, Plugging, and Upgrading a PDB to a New

Unplugging, Plugging, and Upgrading a PDB to a New

相關文章
相關標籤/搜索