Oracle Pluggable Database Automatic Startup

Introduction
Connect to the Container Database (CDB)
Check the Current Startup Mode
Open the PDBs
Save the PDB State
Verify the Saved State
Restart the CDB and Verify
Discarding the Saved State
Conclusion

Introduction

Starting with Oracle Database 12c, the Multitenant Architecture introduced the concept of Container Databases (CDBs) and Pluggable Databases (PDBs). When you start up a CDB, its associated PDBs remain in a "MOUNTED" state by default. To ensure that PDBs open automatically whenever the CDB starts, you can configure them to save their state. Here is a step-by-step guide to setting up automatic startup for your Oracle PDBs:.

Connect to the Container Database (CDB)

First, connect to your CDB using SQL*Plus or any other Oracle client tool:

 sqlplus / as sysdba

Check the Current Startup Mode

To verify the current state of your PDBs, run the following command:

SQL> show pdbs;

CON_ID CON_     NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
    2         PDB$SEED                       READ ONLY  NO
    3         DBDOCSPDB                      MOUNTED
The output displays the open mode for each PDB. Initially, the DBDOCSPDB is in the "MOUNTED" state.

Open the PDBs

You need to open each PDB manually:

SQL> alter pluggable database dbdocspdb open;
Pluggable database altered.
Replace dbdocspdb with the actual name of your PDB. Repeat this for each PDB you want to open automatically.

Save the PDB State

To save the open state so that the PDBs automatically open next time the CDB is started, use the SAVE STATE command:

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

SQL>

Verify the Saved State

You can verify the saved state of your PDBs by querying the DBA_PDB_SAVED_STATES view:

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

SQL>

Restart the CDB and Verify

Finally, restart the CDB to ensure the PDBs open automatically:

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
SQL>
You should see the PDBs in the "READ WRITE" mode, indicating they have opened automatically.

Discarding the Saved State

If you decide to revert the automatic startup setting, you can discard the saved state:

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

SQL>
After this, when you restart the CDB, the specified PDB will start in the "MOUNTED" state.

Conclusion

Setting up the automatic startup for Oracle PDBs ensures they are available without manual intervention each time the CDB starts, enhancing the ease of management and availability. This feature is particularly useful in environments where high availability is critical.

Related content



Rate Your Experience

: 89 : 1


Last updated in July, 2024

Online Tests
Read more

Oracle Database
Read more

MSSQL Database
Read more

PostGres Database
Read more

Linux
Read more

ASP/C#
Read more

Quick Access