Enhance Skills Daily

October 02, 2026

Oracle DBA Lesson 27 Part 2 — Preserve a PDB’s Open State Across Restart

A PDB's current open mode and its saved restart behavior answer different questions. Opening SHOP makes it available for work now. SAVE STATE preserves its open mode when the CDB restarts. DISCARD STATE removes that persistence without immediately closing the currently open PDB.

Oracle DBA Lesson 27 Part 2 — Preserve a PDB’s Open State Across Restart

The practical task is to establish the intended state, inspect the saved setting, and verify what actually returns after restart. This continues the named-PDB availability lesson with a distinct restart decision.

Scope

Use a root administrative session authenticated AS SYSDBA with the applicable privilege in root and in SHOP. Check the current container before a root operation. The named command targets SHOP. This exercise does not use ALL and does not alter the seed. SAVE STATE or DISCARD STATE without an instance clause applies to the current instance. It is not a RAC-wide procedure.

A CDB restart affects the shared instance and all of its PDBs. See administering a CDB.

Establish the intended state

The carried case needs ordinary application users to insert orders. The intended state is READ WRITE, with RESTRICTED NO for normal access. READ ONLY would prevent ordinary user changes. Restricted access adds a connection privilege requirement. Choose the state from the required work rather than saving an accidental maintenance condition.

In the root session:

SHOW CON_NAME
SELECT name, open_mode, restricted
FROM v$pdbs
WHERE name = 'SHOP';

SHOW CON_NAME should identify CDB$ROOT. V$PDBS describes PDBs associated with the current instance. NAME identifies the selected PDB. OPEN_MODE describes its actual current mode. RESTRICTED describes the entry condition. Verify the actual result and the opening messages. If the target or the state differs from the requirement, stop and resolve it before saving. See V$PDBS.

If SHOP is MOUNTED and the root is READ WRITE, the preceding lesson's named opening applies:

ALTER PLUGGABLE DATABASE SHOP OPEN READ WRITE;

Then repeat the query. A currently open PDB that needs a different mode may require a coordinated close and reopening. Do not assume the mounted-target opening applies to every initial state. A close can disconnect sessions and roll back unfinished transactions. Use the preceding lesson's controlled procedure. No close is required when the target already has the intended state.

Save and inspect the restart setting

Once the intended current state is established:

ALTER PLUGGABLE DATABASE SHOP SAVE STATE;

SELECT con_name, instance_name, state, restricted
FROM dba_pdb_saved_states
WHERE con_name = 'SHOP';

SAVE STATE records the selected PDB's restart behavior. It is not the command that opens a mounted PDB. In this unchanged READ WRITE case, that mode is preserved across the restart. See ALTER PLUGGABLE DATABASE.

Interpret the saved-state query by its fields:

FieldQuestion it answers
CON_NAMEWhich PDB has a saved setting?
INSTANCE_NAMEWhich instance is associated with that setting?
STATEWhat open state is saved?
RESTRICTEDWhat restricted mode is saved?

Oracle's view reference describes STATE as the PDB's open state. Do not assume its literal display format is identical to OPEN_MODE without checking your release. A missing row means the query found no saved setting under the selected name and visible scope. Verify identity and access before interpreting that absence as a configuration fact. See DBA_PDB_SAVED_STATES.

Check this record before the restart, particularly after a state change. Keep SHOP in the intended state between SAVE STATE and the restart.

Verify after restart

After confirming root context:

SHUTDOWN IMMEDIATE
STARTUP

These root actions stop and restart the CDB instance. They are not a named-PDB close. Follow the designated restart method instead when Oracle Restart or another manager owns the database lifecycle. Consult the shutdown lesson for transaction and session consequences. See SHUTDOWN.

After the CDB opens, reconnect to root and repeat the named V$PDBS query. In this unchanged saved READ WRITE case, READ WRITE is the expected mode. Verify RESTRICTED too. Expected behavior is a requirement to check, not evidence of a successful restart. If the result differs, inspect the saved-state record, the opening messages, and the startup configuration.

Then test the supplied application service:

CONNECT APP_USER@APP_SERVICE
SHOW CON_NAME

Use the normal credential prompt or a wallet. APP_SERVICE need not equal the PDB name. Confirm the connected container and test the query or transaction for the required work.

Saved PDB state and service availability are separate. A configured Oracle Restart or Clusterware service start with a PDB association can also open a closed PDB READ WRITE. An administrator or startup automation may open it as well. Record the actual service and startup configuration, so an open result is not incorrectly attributed solely to SAVE STATE. This lesson does not configure those services or claim that SAVE STATE starts every custom service. See preserving or discarding a PDB open mode.

Remove persistence without closing the PDB

In the root session:

ALTER PLUGGABLE DATABASE SHOP DISCARD STATE;

Repeat the saved-state query and the current-state query. DISCARD STATE removes the persistence record for the selected scope. SHOP can remain READ WRITE now. Closing the PDB is a separate operation.

Without saved state, the default PDB mode after a CDB restart is MOUNTED. Subsequent administrative or configured service actions may open it. Distinguish the default startup behavior from the actual state you observe afterward.

Quiz

1. Does DISCARD STATE immediately close a currently open PDB?

2. What should be checked before SAVE STATE?

3. Which view describes the saved setting and its instance association?

4. SHOP is READ WRITE after restart. What establishes application readiness?

5. No saved record exists, but SHOP is open after restart. What should be investigated?

No comments:

Post a Comment

Vocabulary Revision 6 — Lessons 21 to 24

Lessons 21–24 · 16 words Watch on YouTube Contents https://www.apps-dba.com/ https://www.youtube.com/@EnhanceSkillsDaily Open ...