码迷,mamicode.com
首页 > 数据库 > 详细

12c PDB自启动

时间:2018-01-20 14:03:19      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:ase   通过   imm   状态   情况   方式   created   mount   name   

默认情况下,在CDB 启动的时候,all 的PDB 都是mount状态,也没有默认的机制,在CDB启动时自动启动PDB。

这里我们通过触发器的方式实现。

CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE ‘ALTER PLUGGABLE DATABASE ALL OPEN‘;
END open_pdbs;
/

实验过程如下:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1560281088 bytes
Fixed Size                  2924784 bytes
Variable Size             956305168 bytes
Database Buffers          587202560 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           MOUNTED
SQL> CREATE OR REPLACE TRIGGER open_pdbs
  2  AFTER STARTUP ON DATABASE
  3  BEGIN
  4  EXECUTE IMMEDIATE ‘ALTER PLUGGABLE DATABASE ALL OPEN‘;
  5  END open_pdbs;
  6  /

Trigger created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1560281088 bytes
Fixed Size                  2924784 bytes
Variable Size             956305168 bytes
Database Buffers          587202560 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
SQL> 

12c PDB自启动

标签:ase   通过   imm   状态   情况   方式   created   mount   name   

原文地址:http://blog.51cto.com/roidba/2063122

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!