Open PDBs and keep them open across CDB restarts (SAVE STATE)
OracleMultitenantCommand
-- Open all PDBs (RAC: INSTANCES = ALL):
ALTER PLUGGABLE DATABASE ALL OPEN;
-- ALTER PLUGGABLE DATABASE <pdb> OPEN INSTANCES = ALL;
-- Save the current open state (opens automatically after a CDB restart):
ALTER PLUGGABLE DATABASE <pdb> SAVE STATE;
-- Saved states:
SELECT con_name, instance_name, state, restricted FROM dba_pdb_saved_states;
-- Remove the saved state:
ALTER PLUGGABLE DATABASE <pdb> DISCARD STATE;
-- If it opens RESTRICTED, find the reason:
SELECT name, cause, type, message
FROM pdb_plug_in_violations
WHERE status <> 'RESOLVED';What it does
Opens PDBs READ WRITE and saves their current open state so that the PDB opens automatically in the same mode when the CDB restarts.
When to use it
After creating, plugging in or cloning a PDB; when you notice PDBs stay MOUNTED after a CDB restart.
Caution
SAVE STATE records the state at the time of the command: if you run it while the PDB is closed, the "closed" state is recorded (or the record is removed). In RAC the state is per instance; with service-based management (PDB services via srvctl), Clusterware startup is preferred over SAVE STATE. On a Data Guard standby the open mode depends on the role.
Related
- Create a new PDB from PDB$SEED
- Clone a PDB within the same CDB (local / hot clone)
- Clone a PDB from another CDB over a DB link (remote clone)
- Unplug a PDB and plug it into another (or the same) CDB
- Set per-PDB CPU, memory, I/O and storage limits
- Confirm which container you are in and query all PDBs from the root (CDB_ / CONTAINERS)