Unplugging一个PDB Unplugging一个pdb不等于remove一个pdb Unplugging一个pdb会创建一个对应的xml文件,借助该xml文件可以将其添加到其他的cdb pdb被Unplugging后,还会在v$containers中显示,只是状态为mounted 创建一个目录,用来放Unplugging pdb时创建对应的xml文件
$mkdir -p /u12/app/oracle/unplug/unplugdb $ sqlplus '/as sysdba' SQL*Plus: Release 12.1.0.1. Production on Tue Jun :: Copyright (c) , , Oracle. All rights reserved. Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1. - 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 ; CON_ID NAME OPEN_MODE RES
---------- ------------------------------ ---------- ---
PDB$SEED READ ONLY NO
YB READ ONLY NO
YB1 MOUNTED
CLONEDB READ WRITE NO SQL> alter session set container=clonedb; Session altered. SQL> shutdown immediate;
Pluggable Database closed.
SQL> conn /as sysdba
Connected.
SQL> show con_name; CON_NAME
------------------------------
CDB$ROOT
SQL> select con_id,name,open_mode,restricted from v$pdbs order by ; CON_ID NAME OPEN_MODE RES
---------- ------------------------------ ---------- ---
PDB$SEED READ ONLY NO
YB READ ONLY NO
YB1 MOUNTED
CLONEDB MOUNTED SQL> alter pluggable database clonedb unplug into '/u12/app/oracle/unplug/unplugdb/unplugdb.xml'; Pluggable database altered. SQL> select con_id,name,open_mode,restricted from v$pdbs order by ; CON_ID NAME OPEN_MODE RES
---------- ------------------------------ ---------- ---
PDB$SEED READ ONLY NO
YB READ ONLY NO
YB1 MOUNTED
CLONEDB MOUNTED SQL> select name,open_mode,total_size from v$pdbs; NAME OPEN_MODE TOTAL_SIZE
------------------------------ ---------- ----------
PDB$SEED READ ONLY
YB READ ONLY
YB1 MOUNTED
CLONEDB MOUNTED SQL> select pdb_name,status from dba_pdbs; PDB_NAME STATUS
-------------------------------------------------- -------------
YB NORMAL
PDB$SEED NORMAL
YB1 NORMAL
CLONEDB UNPLUGGED 如果想重用该pdb,需要先将该pdb删除,再重新plug到cdb中
SQL> drop pluggable database clonedb; Pluggable database dropped. SQL> select pdb_name,status from dba_pdbs; PDB_NAME STATUS
-------------------------------------------------- -------------
YB NORMAL
PDB$SEED NORMAL
YB1 NORMAL SQL>