New in 23c, you can define an open order for the PDBs. This gives priority to mission-critical PDBs so that they are started first. The priority is for opening and upgrades. Priority values are lower to higher values, with the lower values being processed first. Values can be the same but will be processed in any order with the same value. Priorities will not be copied from source to target PDBs by plug/unplug or refreshable clones.
To change the priority value, use the ALTER PLUGGABLE DATABASE … PRIORITY statement. Values are between 1 and 4096.
SQL> alter pluggable database mmpdb priority 1; SQL> select con_id, priority from v$pdbs;
Starting/Stopping a PDB
From the root container, you can change the open mode of a PDB with the following:
SQL> alter pluggable database salespdb open;
As we discussed in the previous section, you can change the state of the PDB:
SQL> startup pluggable database salespdb open read only;
You can also open or close all pluggables, which will follow the open order with the priority you have set for the PDBs.
SQL> alter pluggable database all open;
SQL> alter pluggable database all close immediate;
From the pluggable database, connect as SYS, and this will look similar to the CDB commands to start and shut down:
$ sqlplus pdbsys/Cr4zyPa$$word1@mm23c:1521/salespdb as sysdba SQL> startup;
To shut down the PDB database when connected to it, use the following command:
SQL> shutdown immediate;
Creating a Pluggable Database Within a CDB
After you have created a CDB, you can start creating PDBs within it. When you instruct Oracle to create a PDB, under the covers it actually copies files from an existing database (seed, PDB, or non-CDB, database instance, which is available in previous versions from 19c and lower) and then builds the new PDB’s metadata in the CDB. The key here is to correctly reference what database you want Oracle to use as a template for creating the
new PDB.
There are several tools for creating (cloning) a PDB, namely, the CREATE PLUGGABLE DATABASE SQL statement, the DBCA utility, and Enterprise Manager Cloud Control. If you understand how to create PDBs using SQL and DBCA, you should easily be able to use the Enterprise Manager screens to achieve the same objectives.
With the CREATE PLUGGABLE DATABASE statement, you can use any of the following sources to create a PDB:
• Seed database
• Existing PDB (either local or remote)
• Non-CDB database
• Unplugged PDB
With the DBCA, you can create a PDB from any of the following sources:
• Seed database
• RMAN backup
• Unplugged PDB
In the following sections, all the CREATE PLUGGABLE DATABASE variants of creating a PDB are covered. With the DBCA, we already created a PDB with the CDB, and you can also create the new PDB from the seed database. You should be able to modify that example for your various needs.