Connect to the remote CDB and prepare the remote PDB for cloning.
Select from V$pdbs; con_id DBID NAME open_mode------------------------------------------------------------ 2 1258043702 pdb$seed READ only 3 3749525766 PDB1 READ only42192587015 P4 mounted 5 255759235 pdb_test READ WRITE
Create a user in the remote database for use with the database link. In this case, we'll use a local user in the remote PDB.
set container=P4; SQL> alter pluggable database P4 open; SQL> Create user Remote_clone_user identified by Remote_clone_user; SQL> Grant Create session,create pluggable database to Remote_clone_user;
Open the remote PDB in read-only mode.
sql> Alter pluggable database P4 close; SQL> Alter pluggable database P4 open read only;
Connect to the local database to initiate the clone.
Select from V$pdbs; con_id DBID NAME open_mode------------------------------------------------------------ 2 3671494824 pdb$seed READ only
Create a database link in the local database, pointing to the remote database.
using ' P4 ';
Create a new PDB in the local database by cloning the remote PDB.
from [Email protected]_link create_file_dest='/u12/app/oracle/oradata/p4';
The PDB is opened in Read-write mode to complete the process.
Sql>SelectCon_id,dbid,name,open_mode fromV$pdbs; con_id DBID NAME Open_mode---------- ---------- ------------------------------ ----------2 3671494824pdb$seed READ only3 2880590083P4 Mountedsql>Alter pluggable database P4 open; SQL>SelectCon_id,dbid,name,open_mode fromV$pdbs; con_id DBID NAME Open_mode---------- ---------- ------------------------------ ----------2 3671494824pdb$seed READ only3 2880590083P4 READ Writesql>
Oracle 12C--Clone a remote PDB