3. 拔出(unplug)mypdb2这个PDB数据库(即在源CDB中删除)
[oracle@gtsv2088r test12]$ sqlplus / as sysdba
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> DROP PLUGGABLE DATABASE mypdb2 including datafiles;
Pluggable database dropped.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLUGDB READ WRITE NO
4 CONT01_PLUG01 MOUNTED
5 MYPDB1 READ ONLY NO
可以看到mypdb2在test12中已经删除。
4. 将mypdb2插入(plug)到test12c这个CDB 数据库中
4.1 拷贝文件到目标CDB目录下 (测试使用的是本机上建立一个CDB,也可以插入远端CDB)
[oracle@gtsv2088r test12]$ cp -R mypdb2_bak/*.dbf ../test12c/pdb2/
[oracle@gtsv2088r test12]$ cd ..
[oracle@gtsv2088r oradata]$ ls
arch test12 test12c
[oracle@gtsv2088r oradata]$ cd test12c
[oracle@gtsv2088r test12c]$ ls
cont01plug01 mypdb1 pdbseed redo01.log redo03.log system01.dbf undotbs01.dbf
control01.ctl pdb2 plugdb redo02.log sysaux01.dbf temp01.dbf users01.dbf
[oracle@gtsv2088r test12c]$ cd pdb2
[oracle@gtsv2088r pdb2]$ ls
hw001.dbf sysaux01.dbf system01.dbf temp01.dbf
可以看到源mypdb2上的文件都已经拷贝到这个CDB下的pdb2这个目录下 。