Oracle 21c: Dedicated Grid Infrastructure resource for a PDB

Starting with Oracle 21c, a PDB is registered as dedicated resource in the Grid Infrastructure.

New Resource Type

A PDB is registered using the new resource type ora.pdb.type. You can use the following command to filter all existing resources of this type.

$> crsctl stat res -w "TYPE = ora.pdb.type"
NAME=ora.c21sfe1_site1.c21sfe1pdb1.pdb
TYPE=ora.pdb.type
TARGET=OFFLINE
STATE=OFFLINE

The naming convention for the resource name is ora.<DB Unique Name>.<PDB Name>.pdb.

Server control (srvctl) was enhanced to handle these resources as well. But it looks like that the documentation is not yet updated.

$> srvctl add pdb -db C21SFE1_SITE1 -pdb NEW_PDB -startoption OPEN
$> srvctl modify pdb -db C21SFE1_SITE1 -pdb NEW_PDB -policy AUTOMATIC
$> srvctl config pdb -db C21SFE1_SITE1 -pdb NEW_PDB
$> srvctl start pdb -db C21SFE1_SITE1 -pdb NEW_PDB
$> srvctl stop pdb -db C21SFE1_SITE1 -pdb NEW_PDB
$> srvctl status pdb -db C21SFE1_SITE1 -pdb NEW_PDB
$> srvctl disable pdb -db C21SFE1_SITE1 -pdb NEW_PDB
$> srvctl remove pdb -db C21SFE1_SITE1 -pdb NEW_PDB

When you try to interact with a PDB resource without creating the PDB beforehand, the following ORA error is raised.

ORA-65011: Pluggable database NEW_PDB does not exist.

Creation of new PDBs

When you create a new PDB using CREATE PLUGGABLE DATABASE command or the DBCA, the new PDB is automatically registered in the Grid Infrastructure when the PDB is opened for the first time.

2021-01-18 18:01:27.140 :    AGFW:140063549634304: [     INFO] {0:0:335} Added new resource: ora.c21sfe1_site1.my_pdb.pdb 1 1 to the agfw
2021-01-18 18:01:27.140 :    AGFW:140063549634304: [     INFO] {0:0:335} Agent sending last reply for: RESOURCE_ADD[ora.c21sfe1_site1.my_pdb.pdb 1 1] ID 4356:1682
2021-01-18 18:01:27.149 :    AGFW:140063549634304: [     INFO] {0:0:335} Agent received the message: RESOURCE_START[ora.c21sfe1_site1.my_pdb.pdb 1 1] ID 4098:1684
2021-01-18 18:01:27.149 :    AGFW:140063549634304: [     INFO] {0:0:335} Preparing START command for: ora.c21sfe1_site1my_pdb.pdb 1 1
2021-01-18 18:01:27.149 :    AGFW:140063549634304: [     INFO] {0:0:335} ora.c21sfe1_site1.my_pdb.pdb 1 1 state changed from: UNKNOWN to: STARTING

Restart Test

Now I want to check if the PDB is correctly started. I have the following starting position. The database and one PDB are online and another PDB is offline.

--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.c21sfe1_site1.c21sfe1pdb1.pdb
      1        OFFLINE OFFLINE                               STABLE
ora.c21sfe1_site1.db
      1        ONLINE  ONLINE       db21c-ol8-s1             Open,HOME=/u00/app/o
                                                             racle/product/21,STA
                                                             BLE
ora.c21sfe1_site1.my_pdb.pdb
      1        ONLINE  ONLINE       db21c-ol8-s1             STABLE

Now I restart my database C21SFE1.

$> srvctl stop database -db C21SFE1_SITE1
$> srvctl start database -db C21SFE1_SITE1

From the alert log of the database, I can see that the PDB start was initiated by the agent.

2021-01-18T18:14:12.243748+01:00
ALTER PLUGGABLE DATABASE "MY_PDB" OPEN   /* pdb agent */ /* {0:0:573} */

What about the PDB Save State?

Before Oracle 21c the current state of a PDB could be saved to be able to start it automatically after the CDB was started or to avoid an automatic start at all.

The PDB save state in CDB_PDB_SAVED_STATES is still honored. When a PDB resource is not started by the Grid Infrastructure, it is started the “normal” way. You see the following message in the database alert log.

2021-01-18T19:24:01.504210+01:00
C21SFE1PDB1(3):Pluggable database C21SFE1PDB1 opening in read write

To avoid confusion, you should use only one method.

References

Leave a Reply

Your email address will not be published.