Oracle Pluggable Database Automatic Startup: A Complete Guide

Introduction

Oracle Database 12c introduced the Multitenant Architecture, which includes Container Databases (CDBs) and Pluggable Databases (PDBs). By default, PDBs remain in a "MOUNTED" state when you start the CDB. To ensure your Oracle Pluggable Databases automatically open with the CDB, you can configure them to save their state. This guide provides a step-by-step approach to setting up Oracle Pluggable Database Automatic Startup effectively.

Connect to the Container Database (CDB)

Begin by connecting to your CDB using SQL*Plus or another Oracle client tool. This step is essential for configuring Oracle Pluggable Database Automatic Startup:


sqlplus / as sysdba
        

Check the Current Startup Mode

To check the current state of your PDBs, execute the following command. This will show the open mode of each PDB and help you understand their current state:


SQL> show pdbs;

CON_ID CON_     NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
    2         PDB$SEED                       READ ONLY  NO
    3         DBDOCSPDB                      MOUNTED
        

Initially, the DBDOCSPDB will be in the "MOUNTED" state.

Open the PDBs

Manually open each PDB to prepare for the Oracle Pluggable Database Automatic Startup. Use the following command:


SQL> alter pluggable database dbdocspdb open;
Pluggable database altered.
        

Replace dbdocspdb with the name of your PDB. Repeat this for all PDBs you want to configure for automatic startup.

Save the PDB State

To ensure that your PDBs open automatically in the future, save their current state using the SAVE STATE command:


SQL> ALTER PLUGGABLE DATABASE DBDOCSPDB SAVE STATE;
Pluggable database altered.
        

This command records the state so that the PDBs reopen in the same state upon the next CDB startup.

Verify the Saved State

To confirm that the state of your PDBs has been saved correctly, query the DBA_PDB_SAVED_STATES view:


SQL> SELECT con_name, state FROM DBA_PDB_SAVED_STATES;
CON_NAME             STATE
-------------------- --------------
DBDOCSPDB            OPEN
        

This query verifies that the PDBs are set to open automatically with the CDB.

Restart the CDB and Verify

Restart the CDB to ensure that the PDBs open automatically as configured:


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

SQL> STARTUP;
ORACLE instance started.

Total System Global Area 2365585232 bytes
Fixed Size                  9688912 bytes
Variable Size             603979776 bytes
Database Buffers         1744830464 bytes
Redo Buffers                7086080 bytes
Database mounted.
Database opened.

SQL> SHOW PDBS;

CON_ID CON_     NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
    2       PDB$SEED                       READ ONLY  NO
    3       DBDOCSPDB                      READ WRITE NO
        

The PDBs should now appear in the "READ WRITE" mode, confirming that the automatic startup configuration is working.

Discarding the Saved State

If you need to revert the automatic startup setting, discard the saved state with the following command:


SQL> ALTER PLUGGABLE DATABASE DBDOCSPDB DISCARD STATE;
Pluggable database altered.
        

After executing this, the PDB will start in the "MOUNTED" state upon the next CDB startup.

Conclusion

Setting up Oracle Pluggable Database Automatic Startup ensures that your PDBs are available immediately after the CDB starts, reducing manual intervention and enhancing database availability. This configuration is vital for high-availability environments and streamlines database management significantly.


Related content



Rate Your Experience

: 89 : 1


Last updated in November, 2024

Online Tests
Read more

Cloud Technology
Read more

Oracle Database
Read more

MSSQL Database
Read more

PostGres Database
Read more

Linux
Read more

ASP/C#
Read more

Quick Access