We will crete new pluggable database using unplugged database.
SYS@ORCL19 SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLUG19 READ WRITE NO
4 PLUG19_2 READ WRITE NO
SYS@ORCL19 SQL> alter pluggable database plug19_2 close immediate;
Pluggable database altered.
We will uplug the database in the xml file.
SYS@ORCL19 SQL> alter pluggable database plug19_2 unplug into '/tmp/plug19_2.xml';
Pluggable database altered.
Drop the old pdb database, but keep datafiles..
SYS@ORCL19 SQL> drop pluggable database plug19_2 keep datafiles;
Pluggable database dropped.
SYS@ORCL19 SQL> create pluggable database plug19_3 using '/tmp/plug19_2.xml' copy;
Pluggable database created.
SYS@ORCL19 SQL> alter pluggable database plug19_3 open read write;
Pluggable database altered.
SYS@ORCL19 SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLUG19 READ WRITE NO
5 PLUG19_3 READ WRITE NO
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLUG19 READ WRITE NO
4 PLUG19_2 READ WRITE NO
SYS@ORCL19 SQL> alter pluggable database plug19_2 close immediate;
Pluggable database altered.
We will uplug the database in the xml file.
SYS@ORCL19 SQL> alter pluggable database plug19_2 unplug into '/tmp/plug19_2.xml';
Pluggable database altered.
Drop the old pdb database, but keep datafiles..
SYS@ORCL19 SQL> drop pluggable database plug19_2 keep datafiles;
Pluggable database dropped.
SYS@ORCL19 SQL> create pluggable database plug19_3 using '/tmp/plug19_2.xml' copy;
Pluggable database created.
SYS@ORCL19 SQL> alter pluggable database plug19_3 open read write;
Pluggable database altered.
SYS@ORCL19 SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLUG19 READ WRITE NO
5 PLUG19_3 READ WRITE NO
we can use COPY,MOVE, NOCOPY clause in the create database command.
COPY Clause
Specify COPY if you want the files listed in the XML file to be copied to the new location and used for the new PDB. This is the default. You can use the optional file_name_convert clause to use pattern replacement in the new file names. Refer to file_name_convert for the full semantics of this clause.
MOVE Clause
Specify MOVE if you want the files listed in the XML file to be moved, rather than copied, to the new location and used for the new PDB. You can use the optional file_name_convert clause to use pattern replacement in the new file names. Refer to file_name_convert for the full semantics of this clause.
NOCOPY Clause
Specify NOCOPY if you want the files for the PDB to remain in their current locations. Use this clause if there is no need to copy or move the files required to plug in the PDB.
COPY Clause
Specify COPY if you want the files listed in the XML file to be copied to the new location and used for the new PDB. This is the default. You can use the optional file_name_convert clause to use pattern replacement in the new file names. Refer to file_name_convert for the full semantics of this clause.
MOVE Clause
Specify MOVE if you want the files listed in the XML file to be moved, rather than copied, to the new location and used for the new PDB. You can use the optional file_name_convert clause to use pattern replacement in the new file names. Refer to file_name_convert for the full semantics of this clause.
NOCOPY Clause
Specify NOCOPY if you want the files for the PDB to remain in their current locations. Use this clause if there is no need to copy or move the files required to plug in the PDB.