1.使用SQL DEVELOPER
再修改狀態啓動兩個數據庫
2.使用命令克隆
C:\Users\Administrator>sqlplus sys/xxxxxx@newtest as sysdbasql
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.app
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbside
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_nameui
CDB$ROOT
SQL> alter pluggable database pdbtest close immediate
2 ;code
插接式數據庫已變動。orm
SQL> alter pluggable database pdbtest open read only;blog
插接式數據庫已變動。
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');it
插接式數據庫已建立。
SQL> alter pluggable database pdbtest close;
插接式數據庫已變動。io
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