1 Description
The new release of Oracle Multitenant fully supports remote full and snapshot clones over a database link. A non-multitenant container database (CDB) can be adopted as a pluggable database (PDB) simply by cloning it over a database link. Remote snapshot cloning is also supported across two CDBs sharing the same storage.
12c from the beginning, the distal end of the support to clone by dblink PDB, beginning from 12.1.0.2 to support the distal end of clone non-CDB.
Figure 1 to create a PDB PDB by cloning remote
before cloning, pay attention to prerequisites:
-
Complete the prerequisites described in “Preparing for PDBs”.
-
The current user must have the CREATE PLUGGABLE DATABASE system privilege in the root of the CDB that will contain the target PDB.
-
The source PDB or source non-CDB must be in open read-only mode.
-
A database link must enable a connection from the CDB that will contain the target PDB to the remote source. If the source is a remote PDB, then the database link can connect to either the root of the remote CDB or to the remote source PDB.
-
The user that the database link connects with at the remote source must have the CREATE PLUGGABLE DATABASE system privilege in the source PDB or in the non-CDB.
-
If the database link connects to the root in a remote CDB, then the user that the database link connects with must be a common user.
-
The source and target platforms must meet these requirements:
-
They must have the same endianness.
-
The database options installed on the source platform must be the same as, or a subset of, the database options installed on the target platform.
-
-
The source and target must have compatible character sets and national character sets. To be compatible, the character sets and national character sets must meet all of the requirements specified in Oracle Database Globalization Support Guide.
-
If you are creating a PDB by cloning a non-CDB, then both the CDB and the non-CDB must be running Oracle Database 12c Release 1 (12.1.0.2) or later.
For more information check out the official document: http://docs.oracle.com/database/121/ADMIN/cdb_plug.htm#ADMIN13593
Experiment 2
Source Library: 192.168.1.55, CNDBA_PDB
target library: 192.168.1.110, CNDBA_PDB_NEW
Note: All the following operations are carried out in CDB level.
2.1 View the source library PDB
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 CNDBA_PDB MOUNTED --这里我们的目标
2.2 Creating dblink
Target library to create dblink distally directed library
SQL> create public database link cndba_pdb connect to SYSTEM identified by oracle using 'CNDBA_PDB';
Database link created.
- test whether normal dblink
SQL> select * from v$version@cndba_pdb where rownum=1;
BANNER CON_ID
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0
2.3 open source database in read-only mode PDB
SQL> alter pluggable database cndba_pdb open read only;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 CNDBA_PDB READ ONLY NO
2.4 Cloning distal PDB
In the absence of OMF enabled, you must develop file_name_convert
- Create a new target end PDB data file storage directory
SQL> !mkdir -p /u01/app/oracle/oradata/orcl/sihong/cndba_pdb_new/
- start cloning
SQL> CREATE PLUGGABLE DATABASE cndba_pdb_new FROM cndba_pdb@cndba_pdb
file_name_convert=('/u01/app/oracle/oradata/cndba_pdb/','/u01/app/oracle/oradata/orcl/sihong/cndba_pdb_new/'); 2
Pluggable database created.
2.5 Verify successful cloning
SQL> alter session set container=CNDBA_PDB_NEW;
Session altered.
- Data transmission also came
SQL> select count(*) from lei.cndba;
COUNT(*)
----------
200
Now to clone successful.
Note: If the distal end of clone non-CDB, before opening the PDB, need to perform $ ORACLE_HOME / rdbms / admin / noncdb_to_pdb.sql script.