【BUILD_ORACLE】在Oracle cloud資料庫“插拔”PDB的方法

Attack_on_Jager發表於2022-11-24

實驗環境

搭建平臺:VMware Workstation

OS:OL 7.5

DB:Oracle 12.2.0.1


具體步驟

1. 從 PDB 匯出TDE key

SQL> alter session set container=pdbtest;

SQL> administer key management export encryption keys with secret "mySecret" TO '/u01/app/oracle/oradata/tde.exp' force keystore identified by <password>;

注:

(1)TDE key需要啟用(cloud環境預設是啟用的)

(2)TDE wallet路徑:$ORACLE_BASE/admin/<ORACLE_SID>/tde_wallet

 

2. 執行PDB的拔出操作

$ sqlplus / as sysdba

SQL> alter pluggable database pdbtest close immediate;

SQL> alter pluggable database pdbtest unplug into '/u01/app/oracle/oradata/pdbtest.xml';

 

3. 傳輸檔案到目標庫

檔案包括三類:

(1)tde.exp

(2)pdbtest.xml

(3)所有資料檔案

 

4. 執行PDB的插入操作

SQL> create pluggable database pdbtest using '/u01/app/oracle/oradata/pdbtest.xml' nocopy tempfile reuse;

 

SQL> alter pluggable database pdbtest open;

Warning: PDB altered with errors.  ##這裡的報錯是因為沒有匯入TDE key,查詢如下:

SQL> select cause, message,action,status from pdb_plug_in_violations where name='PDBTEST';

 

CAUSE MESSAGE ACTION STATUS

--------------------------------------------------------------------------------

Wallet Key Needed PDB needs to import keys from source. Import keys from source. PENDING


所以接下來我們就準備匯入TDE了!

 

5. 匯入TDE key

SQL> alter session set container=pdbtest;

SQL> administer key management import encryption keys with secret "mySecret" from '/u01/app/oracle/oradata/tde.exp' force keystore identified by <password> with backup;

 

6. 重啟PDB

SQL> conn / as sysdba

SQL> alter pluggable database pdbtest close immediate;

SQL> alter pluggable database pdbtest open; 

Pluggable database altered.    ##再次open無報錯


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69992972/viewspace-2925061/,如需轉載,請註明出處,否則將追究法律責任。

相關文章