1.使用SQL DEVELOPER
再修改状态启动两个数据库
2.使用命令克隆
C:\Users\Administrator>sqlplus sys/xxxxxx@newtest as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 14 13:47:47 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBTEST READ WRITE NO
4 CLONEPDB READ WRITE NO
SQL> show con_name
CON_NAME
CDB$ROOT
SQL> alter pluggable database pdbtest close immediate
2 ;
插接式数据库已变更。
SQL> alter pluggable database pdbtest open read only;
插接式数据库已变更。
SQL> create pluggable database clonepdb2 from pdbtest;
create pluggable database clonepdb2 from pdbtest *
第 1 行出现错误:
ORA-65016: 必须指定 FILE_NAME_CONVERT
SQL> create pluggable database clonepdb2 from pdbtest
2 file_name_convert=
3 ('C:\app\Administrator\virtual\oradata\newtest\pdbtest','C:\app\Administrator\virtual\oradata\newtest\clonepdb2');
插接式数据库已创建。
SQL> alter pluggable database pdbtest close;
插接式数据库已变更。
SQL> alter pluggable database pdbtest open read write;
插接式数据库已变更。
SQL> col con_id format A40
SQL> col open_mode format A20
SQL> col guid format A40
SQL> col open_mode format A20
SQL> set line 100
SQL> select con_id,name,guid,open_mode from v$containers;
CON_ID NAME GUID OPEN_MODE
########## CDB$ROOT 728E7604E58A4D8D8F564226F3889876 READ WRITE
########## PDB$SEED 32CAC9A05E614355926257BE671D9AFC READ ONLY
########## PDBTEST 24549D14BBEB417BAB312BF19BC5259E READ WRITE
########## CLONEPDB D4B2FCAAC2B944CC8AF5864EC7CB853C READ WRITE
########## CLONEPDB2 9D7AE072804E47A297CBBC341D7F650E READ WRITE
SQL> select con_id,name from v$datafile;
CON_ID NAME
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\SYSTEM01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\SYSTEM01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\SYSAUX01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\SYSAUX01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\UNDOTBS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBSEED\UNDOTBS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\USERS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\SYSTEM01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\SYSAUX01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\UNDOTBS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\PDBTEST\USERS01.DBF
CON_ID NAME
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB\SYSTEM01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB\SYSAUX01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB\UNDOTBS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB\USERS01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB2\SYSTEM01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB2\SYSAUX01.DBF
########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB2\UNDOTBS01.DBF ########## C:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\NEWTEST\CLONEPDB2\USERS01.DBF
本文转自whshurk 51CTO博客,原文链接:http://blog.51cto.com/shurk/2050534,如需转载请自行联系原作者