01 創建PDB的四種方式


克隆種子容器

克隆已有的PDB

插入一個非CDB數據庫

插入一個以前拔出的PDB


1.克隆種子容器

 
sqlplus / as sysdba
alter session set db_create_file_dest='/opt/oradata/';
create pluggable database pdbdb admin user pdb_dba identified by oracle 
alter  pluggable database pdbdb open ; 
 
 
 

2. 克隆已有的PDB

 
alter pluggable database q2 close ;
alter pluggable database q2 open read only ;


create pluggable database q1 from q2  
    storage unlimited 
    file_name_convert=none ; 

alter  pluggable database q1  open read wirte ;; 

alter pluggable database q2 close ;
alter pluggable database q2 open read write ; 
 
 

3. 插入一個非CDB數據庫

注:如果是12c以前的版本,就必須先升級到12c, 或者使用data pump 移動該數據庫
 
alter datbase open read only  ;
exec dbms_pdb.describe('/home/oracle/to_pdb.xml')

#數據文件拷貝過去

create pluggable database  p1 using '/home/oracle/to_pdb.xml';
alte session set container=p1 
@noncdb_to_pdb.sql
alter pluggable database p1 open read write ; 
 
 
 
 

4.插入一個以前拔出的PDB

 
alter pluggable database m1 close ;
alter pluggable database m1 unplug into '/home/oracle/to_pdb.xml' 

#數據文件拷貝過去
#drop pluggable database m1 including datafiles ;                     #刪除數據庫和文件
#drop pluggable database pdb01 keep datafiles;                        #刪除數據庫 保存文件

create pluggable database m1 using '/home/oracle/to_pdb.xml' nocopy ;
alte pluggable database m1 open read wirte ; 
 
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM