We can unplug the pluggable database from existing CDB and Plug it in a different CDB or in the same CDB, depending upon the required. While plugging you can keep the pdb name same as before or can give a different name.
DEMO:
Here i will unplug ORCL pdb and then plug it into the same CDP with different name ORCL_PLUG
Connect to the pluggable database ORCL and close it.
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 ORCL READ WRITE NO 5 PROD_MN READ WRITE NO SQL> alter session set container=ORCL; Session altered. SQL> select file_name from dba_data_files; FILE_NAME -------------------------------------------------------------------------------- /home/oracle/app/oracle/oradata/cdb1/orcl/system01.dbf /home/oracle/app/oracle/oradata/cdb1/orcl/sysaux01.dbf SQL> shutdown immediate; Pluggable Database closed.
Connect to container and unplug pdb to a xml file.
[oracle@localhost orcl_plug]$ sqlplus sys/oracle@cdb1 as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 29 03:37:50 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> alter pluggable database ORCL unplug into '/home/oracle/orcl_plug.xml'; Pluggable database altered. 1* select pdb_name, status from dba_pdbs SQL> / PDB_NAME STATUS ----------- --------- ORCL UNPLUGGED PDB$SEED NORMAL PROD_MN NORMAL
Now drop the pluggable database :
SQL> drop pluggable database orcl; Pluggable database dropped.
PLUGGING:
Here i want to plug the pdb orcl to the Same CDP
Connect to root container in target database and create pluggable:
[oracle@localhost orcl_plug]$ sqlplus sys/oracle@cdb1 as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Aug 29 03:37:50 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> create pluggable database orcl_plug using '/home/oracle/orcl_plug.xml' FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/orcl','/home/oracle/app/oracle/oradata/cdb1/orcl_plug'); Pluggable database created.
Open the PDB:
SQL> alter pluggable database orcl_plug open; PDB altered. SQL> select name, open_mode, total_size from v$pdbs; NAME OPEN_MODE TOTAL_SIZE ------------------------------ ---------- ---------- PDB$SEED READ ONLY 870318080 ORCL_PLUG READ WRITE 4396023808 PROD_MN READ WRITE 891289600
hi Admin,
How to create /home/oracle/orcl_plug.xml file to performed unplug pdb to a container db ?