In Oracle version 12.1.0.1, the business PDB cannot be automatically open during the CDB database startup, and if you want to implement this feature, you need to write a trigger to implement the CDB open, and the PDB will open. In 11.1.0.2 and later versions, The business PDB can be automatically open after CDB open by setting alter pluggable DATABASE PDB SAVE state.
PDB not automatically open after database startup
Xff_cdb$root@sys> Startup
The ORACLE routine has started.
Total System Global area 805306368 bytes
Fixed Size 3050800 bytes
Variable Size 394265296 bytes
Database buffers 297795584 bytes
Redo buffers 5337088 bytes
In-memory Area 104857600 bytes
Database loading complete.
The database is already open.
Xff_cdb$root@sys> select * from V$version;
BANNER con_id
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition release 12.1.0.2.0-64bit Production 0
Pl/sql Release 12.1.0.2.0-production 0
CORE 12.1.0.2.0 Production 0
TNS for 64-bit windows:version 12.1.0.2.0-production 0
Nlsrtl Version 12.1.0.2.0-production 0
Xff_cdb$root@sys> show PDBs;
con_id con_name OPEN MODE restricted
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB Mounted
Query Dba_pdb_saved_states no records
Xff_cdb$root@sys> Select Con_name, state from Dba_pdb_saved_states;
No rows selected
Save state under Database mount
xff_cdb$root@sys> ALTER pluggable DATABASE PDB save state;
The plug-in database has changed.
Xff_cdb$root@sys> Select Con_name, state from Dba_pdb_saved_states;
No rows selected
The PDB is mount, execution save state is not logged, proof that save state is unsuccessful
The Save state--setting PDB starts with the CDB in the database open state
xff_cdb$root@sys> ALTER pluggable DATABASE PDB open;
The plug-in database has changed.
xff_cdb$root@sys> ALTER pluggable DATABASE PDB save state;
The plug-in database has changed.
Xff_cdb$root@sys> Col Con_name for A20
Xff_cdb$root@sys> Select Con_name, state from Dba_pdb_saved_states;
Con_name State
-------------------- --------------
PDB OPEN
The PDB is open, and the save state succeeds.
Note that the save state needs to be executed in the PDB open case to take effect.
Restarting the database test PDB starts with CDB
xff_cdb$root@sys> shutdown Immediate
The database has been closed.
The database has been unloaded.
The ORACLE routine has been closed.
Xff_cdb$root@sys> Startup
The ORACLE routine has started.
Total System Global area 805306368 bytes
Fixed Size 3050800 bytes
Variable Size 364905168 bytes
Database buffers 327155712 bytes
Redo buffers 5337088 bytes
In-memory Area 104857600 bytes
Database loading complete.
The database is already open.
Xff_cdb$root@sys> show PDBs;
con_id con_name OPEN MODE restricted
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB READ WRITE NO
Disabling the PDB starts with CDB-discard state
xff_cdb$root@sys> ALTER pluggable DATABASE PDB discard state;
The plug-in database has changed.
Xff_cdb$root@sys> Select Con_name, state from Dba_pdb_saved_states;
No rows selected
xff_cdb$root@sys> shutdown immediate;
The database has been closed.
The database has been unloaded.
The ORACLE routine has been closed.
Xff_cdb$root@sys> Startup
The ORACLE routine has started.
Total System Global area 805306368 bytes
Fixed Size 3050800 bytes
Variable Size 364905168 bytes
Database buffers 327155712 bytes
Redo buffers 5337088 bytes
In-memory Area 104857600 bytes
Database loading complete.
The database is already open.
Xff_cdb$root@sys> show PDBs;
con_id con_name OPEN MODE restricted
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB Mounted
Xff_cdb$root@sys>
12.1.0.1 to set up the PDB to start with CDB
CREATE TRIGGER Open_all_pdbs
After STARTUP
On DATABASE
BEGIN
EXECUTE IMMEDIATE ' alter pluggable database all open ';
End Open_all_pdbs;
/