Oracle 12c中如何自動啟動PDB Pluggable Database
PDB Pluggable Database是12c的一個重要的新特性, 但是對於CDB中的PDB,預設啟動CDB時不會將所有的PDB帶起來,這樣我們就需要手動alter pluggable database ALL OPEN;
[Oracle@clouds ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on 星期四 3月 31 08:52:31 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
串連到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> alter pluggable database bidb1 open;
插接式資料庫已變更。
SQL> alter pluggable database bidb2 open;
插接式資料庫已變更。
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 BIDB1 READ WRITE
4 BIDB2 READ WRITE
--或是直接啟動所有pluggable資料庫
SQL> alter pluggable database all open;
可以通過添加Trigger的形式來定製化startup時自動將PDB OPEN
使用SYS使用者建立如下觸發器即可:
CREATE TRIGGER open_all_pdbs
AFTER STARTUP
ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;
/
這樣,在oracle 12c database 的cdb啟動後,pdb也會自動啟動了。