Friday, October 14, 2016

Automatic Startup of Pluggable Database (PDB) in 12.1.0.2


Prior to 12.1.0.2, when the CDB is started, all PDBs remain in mounted mode. There was no default mechanism to automatically start them when the CDB is started. The way to achieve this is to use a system trigger on the CDB to start some or all of the PDBs.

The 12.1.0.2 patchset has introduced the ability to preserve the startup state of PDBs, We don’t need start up triggers anymore because this version comes with the SAVE STATE option for pluggable databases.

Here is the demonstration,

[oracle@mydb01]:[MYCDB1] $ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Fri Oct 14 22:06:49 2016
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
TAPDB                          READ WRITE

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

Total System Global Area 4194304000 bytes
Fixed Size                  4505200 bytes
Variable Size            2768241040 bytes
Database Buffers         1409286144 bytes
Redo Buffers               12271616 bytes
Database mounted.
Database opened.
SQL> SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
TAPDB                          MOUNTED

Could see that by default all user created PDBs remain in MOUNTED mode. Lets open and save its state.

SQL> ALTER PLUGGABLE DATABASE  TAPDB open;

Pluggable database altered.

SQL> SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
TAPDB                          READ WRITE

SQL> ALTER PLUGGABLE DATABASE TAPDB SAVE STATE;

Pluggable database altered.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL> shut immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup;
ORACLE instance started.
 Total System Global Area 4194304000 bytes
Fixed Size                  4505200 bytes
Variable Size            2768241040 bytes
Database Buffers         1409286144 bytes
Redo Buffers               12271616 bytes
Database mounted.
Database opened.
SQL> SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
TAPDB                          READ WRITE

SQL>



No comments:

Post a Comment