12c Pluggable database autostart


12c_logo

Before Version 12.1.0.2 whenever a container database was started all the pluggable databases associated with container database remains in MOUNT state. The workaround was to write a database startup trigger to open PDB during container startup. A Basic example can found on MOS Note: 1594901.1 12c Pluggable Database is closed on restart of Computer
If you prefer a more dynamic method my colleague has written a blog post Database 12c: Pluggable database autostart like HAS

Beginning with 12.1.0.2 this feature can be achieved with the PDB save state Feature

For example CRMDB needs to be open after the container database restarts and the HRDB can be in mount state

SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 HRDB                           READ WRITE NO
         4 CRMDB                          MOUNTED

We issue the save command in the current state „MOUNT“ for the CRMDB database.

SQL> alter pluggable database CRMDB save state;
Pluggable database altered.

When we restart the Container database all pluggable databases are in MOUNT state. This is right because we saved the MOUNT state.

SQL> show pdbs    
CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 HRDB                           MOUNTED
         4 CRMDB                          MOUNTED

We do the same, but first we open the CRMDB pluggable database in READ WRITE state.

SQL> alter pluggable database CRMDB open;
Pluggable database altered.
SQL>  alter pluggable database CRMDB save state;
Pluggable database altered.

And now after the container database restarts, the CRMDB is in the expected state.

SQL> show pdbs    
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 HRDB                           MOUNTED
         4 CRMDB                          READ WRITE NO

Hope this was helpfully

 

 

 

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s