====== Cloning a PDB between servers using NFS share ======
* Create a Copy of Source PDB
# Set Oracle environment
. oraenv <<< CDB1
# Connect to SQL*Plus
sqlplus / as sysdba
# Check current PDBs
show pdbs
# Create PDB copy
create pluggable database PDB2_COPY from PDB2;
# Verify creation
show pdbs
exit
* Move PDB to NFS Share
# Set Oracle environment
. oraenv <<< SITNECDB
# Connect to SQL*Plus
sqlplus / as sysdba
# Close the PDB
Alter pluggable database SIT_PDB2_COPY close immediate instances=all;
exit
rman target /
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup as copy pluggable database SIT_PDB2_COPY format '/NFS/ORACLE/pdb_copy/%U';
}
switch pluggable database SIT_PDB2_COPY to copy;
exit
* Create Manifest File
sqlplus / as sysdba
alter pluggable database SIT_PDB2_COPY unplug into '/NFS/ORACLE/pdb_copy/SIT_PDB2_COPY.xml';
show pdbs
exit
* Create PDB on Target Server
# Set Oracle environment
. oraenv <<< SITNECDB
sqlplus / as sysdba
create pluggable database PDB2 using '/NFS/ORACLE/pdb_copy/SIT_PDB2_COPY.xml';
exit
* Restore PDB datafiles on Target Server
rman target /
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup as copy pluggable database PDB2 format '+DATA';
}
switch pluggable database PDB2 to copy;
exit
* Clean Up Source CDB
# Drop the PDB copy
drop pluggable database PDB2_COPY including datafiles;
# Verify PDBs
show pdbs
exit
* Clean Up data files on the NFS
# Remove the datafiles on the NFS
cd /NFS/ORACLE
rm -rf /NFS/ORACLE/pdb_copy