oracle 23ai - Control PDB Open Order
Question: If a CDB contains multiple PDBs, how can we control the order in which these PDBs open? Answer: Before Oracle 23ai, there was no direct solution for managing the order of PDB openings. Executing the startup command provided no guarantee about the opening sequence of the PDBs, as they typically opened based on their container numbers. However, Oracle 23ai introduced a new feature allowing users to assign a PRIORITY to each PDB, which determines the order of operations such as opening, upgrading, or restoring PDBs. The general syntax for the command is as follows: ALTER PLUGGABLE DATABASE PRIORITY PDB name is mandatory. PRIORITY can take a value between 1 and 4096. A lower number indicates a higher priority. For example, a PDB with priority 1 will open before one with priority 2. Example: Assigning Priorities SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 RANPDB READ WRITE NO 4 BABOLPDB READ WRITE NO 5 VARAMINPDB READ WRITE NO 6 ABADANPDB READ WRITE NO SQL> ALTER PLUGGABLE DATABASE babolpdb PRIORITY 1; Pluggable database altered. SQL> ALTER PLUGGABLE DATABASE ABADANPDB PRIORITY 2; Pluggable database altered. SQL> ALTER PLUGGABLE DATABASE VARAMINPDB PRIORITY 3; Pluggable database altered. SQL> ALTER PLUGGABLE DATABASE RANPDB PRIORITY 4; Pluggable database altered. Result After Restart Upon restarting the database, PDBs open in the specified order: SQL> startup force; SQL> select OPEN_TIME, NAME, PRIORITY from v$pdbs order by 1; OPEN_TIME NAME PRIORITY ---------------------------------------- ---------- ---------- 10-MAY-23 05.52.43.190 PM +04:30 PDB$SEED 1 10-MAY-23 05.52.43.812 PM +04:30 BABOLPDB 1 10-MAY-23 05.52.44.889 PM +04:30 ABADANPDB 2 10-MAY-23 05.52.45.929 PM +04:30 VARAMINPDB 3 10-MAY-23 05.52.47.102 PM +04:30 RANPDB 4 Result After Restart The opening sequence is also recorded in the Alert Log: PDB$SEED(2):Opening pdb with Resource Manager plan: DEFAULT_PLAN BABOLPDB(4):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18 2023-05-10T17:52:44.739491+04:30 ABADANPDB(6):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18 2023-05-10T17:52:45.784421+04:30 VARAMINPDB(5):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18 2023-05-10T17:52:46.828984+04:30 RANPDB(3):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18 PDB Upgrade Priority (12cR2 and Later) Starting with Oracle 12cR2, upgrade priorities for PDBs can also be set using a similar command: SQL*Plus: Release 12.0.0.0.0 - Production on Wed May 10 16:56:59 2023 SQL> ALTER PLUGGABLE DATABASE babolpdb UPGRADE PRIORITY 5; Pluggable database altered. This ensures precise control over PDB behavior during upgrades.

Question: If a CDB contains multiple PDBs, how can we control the order in which these PDBs open?
Answer:
Before Oracle 23ai, there was no direct solution for managing the order of PDB openings. Executing the startup command provided no guarantee about the opening sequence of the PDBs, as they typically opened based on their container numbers. However, Oracle 23ai introduced a new feature allowing users to assign a PRIORITY to each PDB, which determines the order of operations such as opening, upgrading, or restoring PDBs.
The general syntax for the command is as follows:
ALTER PLUGGABLE DATABASE PRIORITY
PDB name is mandatory.
PRIORITY can take a value between 1 and 4096. A lower number indicates a higher priority. For example, a PDB with priority 1 will open before one with priority 2.
Example: Assigning Priorities
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 RANPDB READ WRITE NO
4 BABOLPDB READ WRITE NO
5 VARAMINPDB READ WRITE NO
6 ABADANPDB READ WRITE NO
SQL> ALTER PLUGGABLE DATABASE babolpdb PRIORITY 1;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE ABADANPDB PRIORITY 2;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE VARAMINPDB PRIORITY 3;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE RANPDB PRIORITY 4;
Pluggable database altered.
Result After Restart
Upon restarting the database, PDBs open in the specified order:
SQL> startup force;
SQL> select OPEN_TIME, NAME, PRIORITY from v$pdbs order by 1;
OPEN_TIME NAME PRIORITY
---------------------------------------- ---------- ----------
10-MAY-23 05.52.43.190 PM +04:30 PDB$SEED 1
10-MAY-23 05.52.43.812 PM +04:30 BABOLPDB 1
10-MAY-23 05.52.44.889 PM +04:30 ABADANPDB 2
10-MAY-23 05.52.45.929 PM +04:30 VARAMINPDB 3
10-MAY-23 05.52.47.102 PM +04:30 RANPDB 4
Result After Restart
The opening sequence is also recorded in the Alert Log:
PDB$SEED(2):Opening pdb with Resource Manager plan: DEFAULT_PLAN
BABOLPDB(4):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
2023-05-10T17:52:44.739491+04:30
ABADANPDB(6):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
2023-05-10T17:52:45.784421+04:30
VARAMINPDB(5):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
2023-05-10T17:52:46.828984+04:30
RANPDB(3):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
PDB Upgrade Priority (12cR2 and Later)
Starting with Oracle 12cR2, upgrade priorities for PDBs can also be set using a similar command:
SQL*Plus: Release 12.0.0.0.0 - Production on Wed May 10 16:56:59 2023
SQL> ALTER PLUGGABLE DATABASE babolpdb UPGRADE PRIORITY 5;
Pluggable database altered.
This ensures precise control over PDB behavior during upgrades.