Test environment
SOURCE Environment
|
Target Environment
|
Host operating system Oracle Linux 7.2
Host name Zhankys
Oracle version 11.2.0.1 x64 ip:172.16.171.214
Cdb=orcl
The cloned PDB=ORCL1 |
Host operating system Oracle Linux 7.2
Host name Zhanky2 Oracle version 11.2.0.1 x64 ip:172.16.171.215
Cdb=cs
The PDB=CS2 after cloning |
Test ideas
1, the source side established CP has the Create pluggable database and create session permissions (under the PDB orcle1 user)
2. Set the source side to read-only mode (set in CDB mode)
3. Add ORCL1 tnsnames (added in Tnsnames.ora) on the target side
4. Create Orcle1 Dblink:cp_link (run in CDB mode) on the target side
5. Specify the db_create_file_dest path on the target side (run in CDB mode if the directory does not exist and need to be created beforehand)
6. Execute Clone PDB statement (run in CDB mode)
7. Check that the data is correct (running in PDB mode)
Source-side
[Email protected] ~]$ Sqlplus/as SYSDBA
Sql*plus:release 12.2.0.1.0 Production on Fri 3 16:21:35 2018
Copyright (c) 1982, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit Production
Sql> alter session set CONTAINER=ORCL1;
Sql> select * from Zky.aa;
USERNAME
--------------------------------------------------------------------------------
Zky
1 rows selected.
Sql> create user CP identified by CP;
User created.
Sql> Grant Create session,create pluggable database to CP;
Grant succeeded.
Sql> alter session set Container=cdb$root;
sql> Alter pluggable database ORCL1 close;
Pluggable database altered.
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 ORCL1 READ only NO
4 ORCL2 READ WRITE NO
Sql>
Destination End
[Email protected] ~]$ Vi/u01/app/oracle/product/12.2.0/db_1/network/admin/tnsnames.ora
[Email protected] ~]$ Cat/u01/app/oracle/product/12.2.0/db_1/network/admin/tnsnames.ora
# Tnsnames.ora Network Configuration File:/u01/app/oracle/product/12.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
Listener_cs =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.171/215) (PORT = 1521))
CS1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.171.215) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = cs1.zhanky.com)
)
)
CS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.171.215) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = cs.zhanky.com)
)
)
ORCL1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.171.214) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = orcl1.zhanky.com)
)
)
[Email protected] ~]$
Sql> CREATE DATABASE link Cp_link Connect to the CP identified by CP using ' ORCL1 ';
Database Link created.
Sql> Select COUNT (*) from [email protected]_link;
COUNT (*)
----------
41
Sql> alter system set db_create_file_dest= '/U01/APP/ORACLE/ORADATA/CS/CS2 ';
System altered.
Sql> Create pluggable database cs2 from [email protected]_link;
Pluggable database created.
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 CS1 READ WRITE NO
4 CS2 Mounted
Sql> alter session set CONTAINER=CS2;
Session altered.
Sql> Startup
Pluggable Database opened.
Sql> select * from Zky.aa;
USERNAME
--------------------------------------------------------------------------------
Zky
1 rows selected.
Sql>
Complete the test, because the time reason is not explained in detail, first will look at it.
migrating PDB between different CDB