在多租户(容器)数据库中如何创建PDB:方法6 DBCA本地克隆PDB

基于版本:19c (12.2.0.3) AskScuti

创建方法:DBCA静默本地克隆PDB。根据 CDB1 中的 PDB1 克隆出 CDB1 中的 PDB_CLONE

对应路径:Creating a PDB --> Cloning --> 无对应路径(DBCA)

在容器数据库CDB里面如何创建PDB,官方文档给出了一张创建PDB技术选项图,图片如下:

在多租户(容器)数据库中如何创建PDB:方法6 DBCA本地克隆PDB

注意:DBCA静默克隆建库,方法没有在此图片上显示,本文将DBCA方法记在Cloning下面

另外:DBCA克隆或重定位PDB,不支持开启了OMF的CDB, CDB1和CDB2必须都为归档模式。

内容总览

1. 概述

2. CDB1:PDB1确认用户和数据

3. CDB1进行DBCA本地克隆

4. CDB1验证

1. 概述

通过DBCA工具进行静默本地克隆,根据 CDB1 中的 PDB1 克隆出 PDB_CLONE

CDB1PDB1)中有个用户SCOTT,下面有张表 EMP

CDB1下面的 PDB1 静默创建克隆出 PDB_CLONE,并验证 PDB_CLONE 中是否存在SCOTT用户及EMP表。

2. CDB1:PDB1确认用户和数据

[oracle@erp ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 29 21:55:59 2019
Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED
---------- --------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL> alter session set container=pdb1; Session altered. SQL> select count(1) from scott.emp; COUNT(1)
----------
14

3. CDB1进行DBCA本地克隆

dbca -silent -createPluggableDatabase -sourceDB cdb1 -createPDBFrom PDB -pdbName pdb_clone -sourcePDB pdb1

过程

[oracle@erp ~]$ dbca -silent -createPluggableDatabase -sourceDB cdb1 -createPDBFrom PDB -pdbName pdb_clone -sourcePDB pdb1
Prepare for db operation
13% complete
Creating Pluggable Database
15% complete
19% complete
23% complete
31% complete
53% complete
Completing Pluggable Database Creation
60% complete
Executing Post Configuration Actions
100% complete
Pluggable database "pdb_clone" plugged successfully.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/pdb_clone/cdb1.log" for further details.

4. CDB1验证

[oracle@erp ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 29 22:20:11 2019
Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED
---------- --------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB_CLONE READ WRITE NO
SQL> alter session set container=pdb_clone; Session altered. SQL> select count(*) from scott.emp; COUNT(*)
----------
14
上一篇:Oracle12c Clone PDB 的方法


下一篇:Oracle12c创建及删除PDB