12c Unplugging and Plugging the Database in the Same Container Database-PART7   Leave a comment

Here we are going to unplug TESTPDB1 and plug again with different name as “pdb_plug_nocopy”

So here we have 1 Container Database
1 Seeded Pluggable Database
1 Pluggable databases


Close the database.

alter pluggable database TESTPDB1 close immediate;

29-10-2013 12-44-50

Unlug the closed TESTPDB1 and then specify the path and name of the XML file.

mkdir -p /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/

alter pluggable database TESTPDB1 unplug into ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’;

29-10-2013 12-47-22

Drop the closed PDB and keep the data files.

drop pluggable database TESTPDB1 keep datafiles;

select pdb_name, status from cdb_pdbs where pdb_name=’TESTPDB1′;

29-10-2013 12-48-08

The unplugging operation makes changes in the TESTPDB1 data files to record that the PDB was properly and successfully unplugged.

move the datafiles of testpd1 from /u01/app/oracle/oradata/CDB/testpdb1 to /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/

also edit the /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml as per the changed locations accordingly.

Checking the Compatibility of the Unplugged PDB with the Host CDB
Before starting the plugging operation, make sure that the to-be-plugged-in PDB is compatible with the new host CDB. Execution of the PL/SQL block raises an error if it is not compatible.

Execute the following PL/SQL block:

set serveroutput on
compatible BOOLEAN := FALSE;
pdb_descr_file => ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’);
if compatible then
DBMS_OUTPUT.PUT_LINE(‘Is pluggable TESTPDB1 compatible? YES’);
else DBMS_OUTPUT.PUT_LINE(‘Is pluggable TESTPDB1 compatible? NO’);
end if;

29-10-2013 12-57-29

Plugging the Unplugged TESTPDB1: NOCOPY Method
Use the data files of the unplugged PDB to plug the PDB into another CDB without any copy.

create pluggable database pdb_plug_nocopy using ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’
TEMPFILE REUSE;29-10-2013 12-58-13

This operation lasts a few seconds. The original data files of the unplugged PDB now belong to the new plugged-in PDB in the new host CDB. A file with the same name as the temp file specified in the XML file exists in the target location. Therefore, the TEMPFILE_REUSE clause is required.

Verify the status and open mode of the plugged PDB. Proceed to the next section, “Opening the Plugged PDB,” to finalize the plugging operation.
select pdb_name, status from cdb_pdbs where pdb_name=’pdb_plug_nocopy’;

select open_mode from v$pdbs where name=’pdb_plug_nocopy’;

List the data files of the plugged PDB.
select name from v$datafile where con_id=3;

29-10-2013 13-13-04

Open the Database




NOTE: TESTPDB2 is another Pluggable Database which was there already.


Posted October 29, 2013 by balaoracledba.com in 12cDatabase

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: