Oracle 12c 多租户在 CDB 中 Plug A PDB,Unplugging A PDB

Oracle 数据库 12 c 中介绍了多租户选项允许单个容器数据库 (CDB) 来承载多个单独的可插拔数据库 (PDB)。
本文简单的演示了如何在 CDB 中 Plug A PDB,Unplugging A PDB 操作。


一、 plugged PDB into Unplugged PDB
SQL> show pdbs
    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED  READ ONLY  NO
3 PDB01  READ WRITE NO
SQL>alter pluggable database pdb01 close immediate;
SQL>alter pluggable database pdb01 unplug into '/home/oracle/pdb01.xml';
[oracle@12c01 ~]$ pwd
/home/oracle
[oracle@12c01 ~]$ ll pdb01.xml 
-rw-r--r--. 1 oracle oinstall 7758 May  7 05:09 pdb01.xml
[oracle@12c01 ~]$ cat pdb01.xml 
<?xml version="1.0" encoding="UTF-8"?>
<PDB>
  <xmlversion>1</xmlversion>
  <pdbname>PDB01</pdbname>
  <cid>3</cid>
  <byteorder>1</byteorder>
  <vsn>203424000</vsn>
  <vsns>
    <vsnnum>12.2.0.1.0</vsnnum>
    <cdbcompt>12.2.0.0.0</cdbcompt>
    <pdbcompt>12.2.0.0.0</pdbcompt>
    <vsnlibnum>0.0.0.0.24</vsnlibnum>
    <vsnsql>24</vsnsql>
    <vsnbsv>8.0.0.0.0</vsnbsv>
  </vsns>
  <dbid>2550500229</dbid>
...省略
SQL> show pdbs   
    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED   READ ONLY  NO
3 PDB01   MOUNTED
SQL> drop pluggable database pdb01 keep datafiles;
Pluggable database dropped.
SQL> show pdbs    
    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED   READ ONLY  NO


二、 Plug Unplugged PDB into CDB

SQL> SELECT NAME,CDB FROM V$DATABASE;
NAME  CDB
--------- ---
ANDYCDB   YES
SQL> create  pluggable  database  pdb01  using  '/home/oracle/pdb01.xml';
Pluggable database created.
SQL> show pdbs
    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED  READ ONLY  NO
3 PDB01  MOUNTED
SQL> alter pluggable database pdb01 open;
Pluggable database altered.
SQL> show pdbs
    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED  READ ONLY  NO
3 PDB01  READ WRITE NO

posted on 2017-05-10 11:20  张冲andy  阅读(423)  评论(0编辑  收藏  举报

导航