Adding PDB Resources in Grid Infrastructure

In Oracle Database 21c, within the Grid Infrastructure environment, a new type of resource called ora.pdb.type has been introduced, which can be used to manage PDBs. These resources are named using the following format:

ora.<DB Unique Name>.<PDB Name>.pdb

Like other resources in the cluster and GI environment, PDB-related resources can be controlled and managed using the srvctl tool. For example, you can start or stop a PDB using this tool:

[grid@RAC3 ~]$ srvctl start pdb -db db21c -pdb pdb1

[grid@RAC3 ~]$ srvctl status pdb -db db21c -pdb pdb1

Pluggable database PDB1 is enabled.

Pluggable database PDB1 of database db21c is running on nodes: rac2,rac3

[grid@RAC3 ~]$ srvctl stop pdb -db db21c -pdb pdb1

[grid@RAC3 ~]$ srvctl status pdb -db db21c -pdb pdb1

Pluggable database PDB1 is enabled.

Pluggable database PDB1 of database db21c is not running.

[oracle@RAC2 ~]$ srvctl stop pdb -db db21c -pdb pdb1 -n rac3 -stopoption IMMEDIATE

You can also configure a PDB to start automatically using srvctl, without using triggers or saved state:

SQL>  select * from dba_PDB_SAVED_STATES ;

no rows selected


[oracle@RAC3 ~]$ srvctl modify pdb -db db21c -pdb pdb1 -policy AUTOMATIC

[oracle@RAC3 ~]$ srvctl stop database -db db21c

[oracle@RAC3 ~]$ srvctl start database -db db21c


SQL*Plus: Release 21.0.0.0.0 – Production on Wed Oct 13 11:18:02 2021

Version 21.3.0.0.0

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED

———- —————————— ———- ———-

2 PDB$SEED READ ONLY NO

3 PDB1 READ WRITE NO

Using this tool, you can also manually remove or add a PDB resource from/to Grid Infrastructure:

 [oracle@RAC3 ~]$ srvctl remove pdb -db db21c -pdb pdb2

Remove the PDB pdb2? (y/[n]) y

[oracle@RAC3 ~]$ srvctl add pdb -db db21c -pdb pdb2 -startoption OPEN

However, when a new PDB is created in the cluster, its corresponding resource is automatically registered in Grid Infrastructure when the PDB is opened:

SQL> create pluggable database pdb2 admin user a identified by a;

Pluggable database created.

SQL> alter pluggable database pdb2 open;

Pluggable database altered.


[root@RAC3 bin]# ./crsctl stat res -w “TYPE = ora.pdb.type”

NAME=ora.db21c.pdb1.pdb

TYPE=ora.pdb.type

TARGET=ONLINE , ONLINE

STATE=ONLINE on rac2, ONLINE on rac3

NAME=ora.db21c.pdb2.pdb

TYPE=ora.pdb.type

TARGET=ONLINE , OFFLINE

STATE=ONLINE on rac2, OFFLINE
Vahid Yousefzadeh

Written by Vahid Yousefzadeh


I have been a DBA since 2011 and I work with Oracle technology. Linkdin: linkedin.com/in/vahidusefzadeh telegram channel ID:@oracledb vahidusefzadeh@gmail.com

Comments

Popular posts from this blog

Oracle 21c Enhancements for TTS Export/Import

Oracle 23ai — Speed up IMPDP Using NOVALIDATE Constraints

Staging Tables in Oracle 23ai