首页 热点资讯 义务教育 高等教育 出国留学 考研考公
您的当前位置:首页正文

Unplugging一个PDB

2023-11-11 来源:华拓网
技术分享
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.0 Production on Tue Jun 23 14:19:54 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 READ ONLY NO
 4 YB1 MOUNTED
 5 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 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> 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 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> select name,open_mode,total_size from v$pdbs;

NAME OPEN_MODE TOTAL_SIZE
------------------------------ ---------- ----------
PDB$SEED READ ONLY 283115520
YB READ ONLY 393216000
YB1 MOUNTED 0
CLONEDB MOUNTED 0

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> 
技术分享

Unplugging一个PDB

标签:from   only   xml文件   rom   container   ase   move   nta   等于   

显示全文