12c可插拔数据库CDB与PDB管理总结

12c可插拔数据库CDB与PDB管理总结网址:yii666.com<网址:yii666.com

创建pdb
1、直接创建

 CREATE PLUGGABLE DATABASE pdb2
ADMIN USER boswll IDENTIFIED BY oracle
STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M)
DEFAULT TABLESPACE test DATAFILE '/opt/oracle/oradata/orcl/datafile/test_001.dbf' SIZE 25M AUTOEXTEND ON;

2、以现有pdb为模板创建
现有pdb必须在read only模式下才能被创建,否则报错
以pdb1为模板创建pdb2文章地址https://www.yii666.com/article/764151.html文章来源地址:https://www.yii666.com/article/764151.html

 alter pluggable database pdb2 close immediate;
drop pluggable database pdb2 including datafiles;
alter pluggable database pdb1 close;
alter pluggable database pdb1 open read only;
create pluggable database pdb2
from pdb1
file_name_convert =('/opt/oracle/oradata/orcl/E98BEB85B1A80C56E0439A02A8C05841/datafile/','/opt/oracle/oradata/orcl/datafile/pdb2');

打开关闭pdb

 alter pluggable database all open;
alter pluggable database pdb2 close;
alter pluggable database all close;
alter pluggable database pdb2 close immediate;
alter pluggable database pdb2 open;
alter pluggable database all open;

删除pdb
与删除表空间类似,可以级联删除数据文件文章来源地址https://www.yii666.com/article/764151.html

 drop pluggable database pdb2;
drop pluggable database pdb2 including datafiles;

只是删除库,不删除文件

 DROP PLUGGABLE DATABASE pdb2 KEEP DATAFILES; 
 保持启动CDB后PDB的状态
alter pluggable database all save state;
shut immediate;
startup 容器之间的切换
alter session set container=CDB$ROOT;
alter session set container=pdb5; 查看当前容器
show con_name
select sys_context('userenv', 'con_name') "Container DB" from dual; 查看pdb的信息
查看CDB中有多少个pluggable database
alter session set container=CDB$ROOT;
show pdbs
select con_id, dbid, guid, name , open_mode from v$pdbs;

版权声明:本文内容来源于网络,版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。文本页已经标记具体来源原文地址,请点击原文查看来源网址,站内文章以及资源内容站长不承诺其正确性,如侵犯了您的权益,请联系站长如有侵权请联系站长,将立刻删除

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信图片_20190322181744_03.jpg

微信扫一扫打赏

请作者喝杯咖啡吧~

支付宝扫一扫领取红包,优惠每天领

二维码1

zhifubaohongbao.png

二维码2

zhifubaohongbao2.png