1 第一种方式设置自动启动方式
SQL> create pluggable database orcl admin user oper identified by "ora#123" file_name_convert=('SEEDDB','ORCL/DATAFILE','seeddb','orcl/datafile'); ###创建orcl pdb数据库
Pluggable database created.
SQL> alter pluggable database orcl open; --打开pdb数据库
Pluggable database altered.
SQL> alter pluggable database orcl save state; --设置pdb保存
alter pluggable database all close immediate instances=all;
alter pluggable database all open read only instances=all;
alter pluggable database all save state instances=all;
SQL>
2 第2种方式使用trigger的方式;
SQL>alter session set container=CDB$ROOT;
Session altered.
CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
3 打开所有pdb
alter pluggable database all open;
CDB的打开和关闭和以前的非CDB环境一致,可以打开带nomount,mount,open
PDB可以打开到mount,migrate,read only,read write,注意PDB不能打开到nomount
3 关闭pdb
alter pluggable database all close immediate ;
alter pluggable database orcl open;
alter pluggable database orcl open read only;
alter pluggable database orcl open upgrade restricted;
alter pluggable database orcl close;
alter pluggable database orcl close immediate;
alter pluggable database all except orcl open;
alter pluggable database all except orcl1,orcl2 close;
alter pluggable database all except orcl1,orcl2 close;