实验环境
搭建平台: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无报错