How to create a PDB in multi-tenant (container) database: Method 5 DBCA remote cloning PDB

Based on version: 19C (12.2.0.3)  AskScuti

Creation Method: DBCA silent remote cloning PDB. The CDB1 in PDB1 clone  CDB2  in ERP2

Corresponding path: Creating the PDB A -> Cloning -> no corresponding path (the DBCA)

How to create a container inside the PDB database CDB, the official document gives an option to create a PDB technical drawing , picture is as follows:

Note: DBCA silent clone building a database, there is no method in this picture shows, this article will DBCA method recorded in Cloning below .

Further: the DBCA cloning or repositioning PDB, do not support the opening of OMF the CDB,  CDB1 and CDB2 must both archiving mode .

 

Content Overview

1 Overview

2. CDB1: PDB1 confirm users and data

3. CDB1 create public users and authorized

4. CDB2 be cloned DBCA

5. CDB2 verification

6. error conditions

 

1 Overview

Silent DBCA cloning tool, two databases CDB: CDB1 ( PDB1 ) and CDB2 ( ERP1 ).

host 1: 192.168.1.12 CDB1 (PDB1) remote server

host 2: 192.168.1.14 CDB2 (ERP1) local server

CDB1 ( PDB1 in) users have the HR , the following tables have the EMPLOYEES .

The CDB1 following PDB1 muting create remote cloned into CDB2 the ERP2 , HR user and verifying the presence and in the EMPLOYEES table ERP2.

 

2. CDB1: PDB1 confirm users and data

[oracle@henry ~]$ sqlplus hr/hr@pdb1

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 28 09:19:35 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Wed Aug 28 2019 09:18:10 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select count(1) from employees;

  COUNT(1)
----------
       107

HR user scripts and creation method can be obtained here .

 

3. CDB1 create public users and authorized

SQL> conn / as sysdba
Connected.
SQL> create user c##remote_user identified by oracle container=all;

User created.

SQL> grant create session,create pluggable database to c##remote_user container=all;

Grant succeeded.

SQL> exit

  

4.  CDB2 be cloned DBCA

dbca -silent -createPluggableDatabase -createFromRemotePDB -remotePDBName pdb1 -remoteDBConnString 192.168.1.12:1521/cdb1 -remoteDBSYSDBAUserName sys -remoteDBSYSDBAUserPassword oracle -sysDBAUserName sys -sysDBAPassword oracle -dbLinkUsername c##remote_user -dbLinkUserPassword oracle -sourceDB cdb2 -pdbName erp2

 

process

[oracle@henry ~]$ dbca -silent -createPluggableDatabase -createFromRemotePDB -remotePDBName pdb1 -remoteDBConnString 192.168.1.12:1521/cdb1 -remoteDBSYSDBAUserName sys -remoteDBSYSDBAUserPassword oracle -sysDBAUserName sys -sysDBAPassword oracle -dbLinkUsername c##remote_user -dbLinkUserPassword oracle -sourceDB cdb2 -pdbName erp2
Prepare for db operation
50% complete
Create pluggable database using remote clone operation
100% complete
Pluggable database "erp2" plugged successfully.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb2/erp2/cdb2.log" for further details.

 

5. CDB2 verification

SQL> show pdbs

    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- --------- ---------- ----------
     2 PDB$SEED      READ ONLY  NO
     3 ERP1          MOUNTED
     4 ERP2          READ WRITE NO
SQL> alter session set container=erp2;

Session altered.

SQL> select count(*) from hr.employees;

  COUNT(*)
----------
       107

 

6. error conditions

Being given a

[FATAL] [DBT-08101] The selected PDB (pdb1) is not open.
   CAUSE: PDB has to be open in READ WRITE mode to perform the configuration.

Check  -remoteDBConnString parameters are specified connection string is correct. Use the monitor in the service name, not an alias tnsname.

 

Two error

[FATAL] [DBT-11502] The instance (CDB2) is not running on the local node.
   CAUSE: A locally running instance is required to perform the selected operation.
   ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.

Check  -sourceDB parameter specifies the instance name is correct. Case-sensitive, if it is capitalized, the need to bring the single quotation marks . Also note that the " source-sink " refers not be cloned database, but to clone the target library .

 

Being given three

[FATAL] [DBT-19401] Archive log mode is not enabled in the (cdb1) database.
   CAUSE: (cdb1) database should be configured with archive log mode to perform the operation.

Check whether the database archiving mode, non-filing mode DBCA can not be cloned.

Guess you like

Origin www.cnblogs.com/askscuti/p/11343135.html