使用已有PDB克隆PDB

使用已有PDB克隆PDB

$ sqlplus '/as sysdba'

SQL*Plus: Release 12.1.0.1.0 Production on Tue Jun 23 13:46:53 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show con_name;

CON_NAME
------------------------------
CDB$ROOT
SQL> select con_id,name,open_mode,restricted from v$pdbs order by 1;

    CON_ID NAME                           OPEN_MODE  RES
---------- ------------------------------ ---------- ---
         2 PDB$SEED                       READ ONLY  NO
         3 YB                             MOUNTED
         4 YB1                            MOUNTED

SQL> alter session set container=yb;

Session altered.

#用来克隆的pdb必须是以read only模式打开
SQL> startup open read only;
Pluggable Database opened.
SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> create pluggable database clonedb from yb file_name_convert=('/u12/app/oracle/oradata/ora12/yb/','/u12/app/oracle/oradata/ora12/clonedb/');

Pluggable database created.

SQL>  select con_id,name,open_mode,restricted from v$pdbs order by 1;

    CON_ID NAME                           OPEN_MODE  RES
---------- ------------------------------ ---------- ---
         2 PDB$SEED                       READ ONLY  NO
         3 YB                             READ ONLY  NO
         4 YB1                            MOUNTED
         5 CLONEDB                        MOUNTED

SQL> 
原文地址:https://www.cnblogs.com/abclife/p/4594135.html