In Oracle Multitenant architecture, SAVE STATE is a feature that allows a Pluggable Database (PDB) to remember its open mode across a CDB restart.
Without SAVE STATE, when the Container Database (CDB) is restarted, all PDBs (except PDB$SEED) typically remain in MOUNTED state and must be opened manually.
Why SAVE STATE is Required
Suppose you have:
PDBPROD is open and users can connect.
After a database restart:
You may find:
Output:
Applications cannot connect until you manually open the PDB.
To avoid this, Oracle provides SAVE STATE.
How to Save PDB State
Open the PDB first:
Save its current state:
Oracle stores this information internally.
Verify Saved State
Query:
Example:
After CDB Restart
Check:
Output:
The PDB automatically opens because Oracle remembered the saved state.
Save State for All PDBs
Very useful after patching or maintenance.
Discard Saved State
If you don't want Oracle to auto-open a PDB:
Verify:
The entry will be removed.
Save Different Open Modes
Read Write
Read Only
After restart, Oracle restores the same mode.
Check Current and Saved State
Current state:
or
Saved state:
RAC Environment
In Oracle RAC, SAVE STATE is instance-specific.
Example:
Check:
You will see an entry for each RAC instance.
Best Practice
After:
- Creating a new PDB
- Cloning a PDB
- Refreshable PDB setup
- Database patching
- Migration to a new server
Always execute:
and verify:
This ensures all required PDBs automatically open after any database restart and avoids application outages caused by PDBs remaining mounted.
No comments:
Post a Comment