Clone a Pluggable Database (PDB) Manually
Cloning an existing local PDB is similar to creating a new PDB
from the seed PDB, except now we are using non-seed PDB as the source, which we
have to identify using the
FROM
clause. Make sure the source PDB is open in READ ONLY
mode.ALTER PLUGGABLE DATABASE pdb3 CLOSE;
ALTER PLUGGABLE DATABASE pdb3 OPEN READ ONLY;
CREATE PLUGGABLE DATABASE pdb4 FROM pdb3
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb3/','/u01/app/oracle/oradata/cdb1/pdb4/');
ALTER PLUGGABLE DATABASE pdb4 OPEN READ WRITE;
-- Switch the source PDB back to read/write
ALTER PLUGGABLE DATABASE pdb3 CLOSE;
ALTER PLUGGABLE DATABASE pdb3 OPEN READ WRITE;
The cloning syntax also allows for cloning from remote databases
using a database link in the local CBD. There are a few restriction associated
with this functionality.
- The database link can point directly to the remote PDB or to a common user in the remote CBD that owns the remote PDB.
- If it points to
a common user in the remote CBD that owns the remote PDB, that user must
have the
CREATE PLUGGABLE DATABASE
system privilege. - The source and target CDBs must have the same endians.
- The source and target CDBs must have the same options installed.
- The source and target CDBs must have the same character set and national character set.
Assuming the remote PDB was in READ ONLY mode, the following
command should perform the required operation.
CREATE PLUGGABLE DATABASE pdb5 FROM remote_pdb5@remotecdb1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/remote_pdb5/','/u01/app/oracle/oradata/cdb1/pdb5/');
ALTER PLUGGABLE DATABASE pdb4 OPEN READ WRITE;