看当前的
sql> show pdbs
    con_id con_name           open mode  restricted
---------- ------------------------------ ---------- ----------
         2 pdb$seed                       read only  no
         3 pdb1                           mounted
         4 pdb2                           mounted
sql> !free -m
              total        used        free      shared  buff/cache   available
mem:           4372         927         222        2649        3222         566
swap:          6143         144        5999
sql> create pluggable database pdbesb
   2  admin user adm identified by pwd
   3  file_name_convert=('pdbseed','pdbesb');
pluggable database created.
sql> show pdbs
    con_id con_name          open mode  restricted
---------- ------------------------------ ---------- ----------
         2 pdb$seed                       read only  no
         3 pdb1                           mounted
         4 pdb2                           mounted
         5 pdbesb                         mounted
从本地克隆
create
pluggable database pdb2 from pdb1
	file_name_convert=('pdb1','pdb2')
	parallel
8;
创建完毕后新pdb是mount状态,需要open一下
alter pluggable database pdb2 open;
通过database
link从远程克隆 
	create
pluggable database pdb1 from pdb1@dblink_to_cdb1
file_name_convert=('cdb1','cdb2');
创建快照pdb
alter system set clonedb=true scope=spfile;
startup force
alter pluggable database pdb1 open read only;
create pluggable database pdbsnap1 from pdb1 snapshot copy file_name_convert('pdb1','pdbsnap');
alter pluggable database pdbsnap open;
--记得把pdb1设置为read write状态
删除旧的pdb
alter pluggable database pdb1 close;
drop pluggable database pdb1 including datafiles;
pdb改名
conn / as sysdba
sho pdbs
alter pluggable database &1 close immediate;
alter pluggable database &1 open restricted;
alter pluggable database &1 rename global_name to &2;
alter pluggable database &2 close immediate;
alter pluggable database &2 open;
sho pdbs
建议将上述脚本存为 renpdb.sql ,执行时:
sql> @renpdb pdb1 pdbnew                                   
              
              阅读(5511) | 评论(0) | 转发(0) |