1:在12c创建完成后,默认情况下使用sqlplus / as sysdba 登录连接的是CDB
查看当前数据库
sqlplus '/as sysdba'
show con_name
2:在CDB 启动之前,PDB 是自动启动到mount状态,而不是OPEN。 所以我们还需要手工去open它,当然,也可以通过在CDB中配置触发器来自动open。
指定PDB 数据库
alter session set container=pdb;
startup
其它管理命令:
如果在PDB中可以使用如下语法:
ALTER PLUGGABLE DATABASE OPEN READ WRITE [RESTRICTED] [FORCE];
ALTER PLUGGABLE DATABASE OPEN READ ONLY [RESTRICTED] [FORCE];
ALTER PLUGGABLE DATABASE OPEN UPGRADE [RESTRICTED];
ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE];
在CDB中,可以使用如下语法:
ALTER PLUGGABLE DATABASE OPEN READ WRITE [RESTRICTED][FORCE];
ALTER PLUGGABLE DATABASE OPEN READ ONLY [RESTRICTED] [FORCE];
ALTER PLUGGABLE DATABASE OPEN UPGRADE [RESTRICTED];
ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE];
其它管理命令:
ALTERPLUGGABLE DATABASE pdb1, pdb2 OPEN READ ONLY FORCE;
ALTERPLUGGABLE DATABASE pdb1, pdb2 CLOSE IMMEDIATE;
ALTERPLUGGABLE DATABASE ALL OPEN;
ALTERPLUGGABLE DATABASE ALL CLOSE IMMEDIATE;
ALTERPLUGGABLE DATABASE ALL EXCEPT pdb1 OPEN;
ALTERPLUGGABLE DATABASE ALL EXCEPT pdb1 CLOSE IMMEDIATE;
4:
设置Pluggable Database (PDB) 的自动startup
默认情况下,在CDB 启动的时候,all 的PDB 都是mount状态,也没有默认的机制,在CDB启动时自动启动PDB。
通过触发器来实现PDB的自动open:
alter session set container=CDB$ROOT;
CREATEOR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTERPLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
/
阅读(4525) | 评论(0) | 转发(0) |