Oracle 26ai RAC PDB Creation and Deletion: Complete Step-by-Step Guide

26ai_en

Operating PDBs in an Oracle 26ai RAC environment requires not only SQL execution but also resource registration with srvctl. This article provides a detailed explanation from Oracle 26ai PDB Creation to Oracle PDB Deletion Procedures, including actual system logs. You will learn how to automate and fortify PDB management in a RAC configuration through Grid Infrastructure (GI) integration.

Conclusion: Shortest Procedure for PDB Creation and Deletion (Do-List)

This is a “to-do list” for managing PDBs while maintaining consistency in a RAC configuration.

Steps for PDB Creation

  1. SQL Execution: Create the PDB using CREATE PLUGGABLE DATABASE ....
  2. Resource Registration: Register with GI using srvctl add pdb -db <CDB_NAME> -pdb <PDB_NAME>.
  3. Startup: Open on all nodes using srvctl start pdb -db <CDB_NAME> -pdb <PDB_NAME>.

Steps for PDB Deletion

  1. Stop: Close the PDB using srvctl stop pdb -db <CDB_NAME> -pdb <PDB_NAME>.
  2. Resource Removal: Unregister from GI using srvctl remove pdb -db <CDB_NAME> -pdb <PDB_NAME>.
  3. SQL Execution: Perform physical deletion using DROP PLUGGABLE DATABASE ... INCLUDING DATAFILES.

Background and Basics: Why is SQL Alone Insufficient?

In a RAC environment, a PDB is treated as a “cluster resource” rather than just a container. Immediately after creating a PDB with a SQL statement, it exists in the data dictionary, but Grid Infrastructure (GI) is not aware of its existence. Therefore, to perform collective monitoring via crsctl or simultaneous startup/shutdown across multiple nodes via srvctl, you must explicitly register it as a resource (srvctl add). In versions 21c, 23ai, and 26ai, this integration has become the standard management best practice.

Implementation: PDB Creation and Registration in 26ai RAC

We will confirm the specific procedures while following the actual system logs in the latest 26ai environment (23.26.1).

1. PDB Creation (Cloning)

First, create a new PDB (pdb02) from an existing PDB (pdb01) as the source via SQL*Plus.

[oracle@rac-26ai1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 23.26.1.0.0 - Production on Fri Feb 13 20:57:52 2026
Version 23.26.1.0.0

Copyright (c) 1982, 2025, Oracle. All rights reserved.


Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
SQL> create pluggable database pdb02 from pdb01; ★

Pluggable database created.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
6 PDB02 MOUNTED
SQL> exit
Disconnected from Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
[oracle@rac-26ai1 ~]$ /u01/app/23.0.0/grid/bin/crsctl stat res -w "TYPE = ora.pdb.type" -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.orcl.pdb01.pdb
1 ONLINE ONLINE rac-26ai1 READ WRITE,STABLE
2 ONLINE ONLINE rac-26ai2 READ WRITE,STABLE
--------------------------------------------------------------------------------

Note: Immediately after creation, pdb02 is in a MOUNTED state and does not yet appear in the management targets (resources) of crsctl.

2. Resource Registration via srvctl

Next, make the clusterware (GI) recognize the created PDB.

[oracle@rac-26ai1 ~]$ srvctl add pdb -db orcl -pdb pdb02  ★
[oracle@rac-26ai1 ~]$ /u01/app/23.0.0/grid/bin/crsctl stat res -w "TYPE = ora.pdb.type" -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.orcl.pdb01.pdb
1 ONLINE ONLINE rac-26ai1 READ WRITE,STABLE
2 ONLINE ONLINE rac-26ai2 READ WRITE,STABLE
ora.orcl.pdb02.pdb ★
1 OFFLINE OFFLINE STABLE
2 OFFLINE OFFLINE STABLE
--------------------------------------------------------------------------------
[oracle@rac-26ai1 ~]$ srvctl start pdb -db orcl -pdb pdb02
[oracle@rac-26ai1 ~]$ /u01/app/23.0.0/grid/bin/crsctl stat res -w "TYPE = ora.pdb.type" -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.orcl.pdb01.pdb
1 ONLINE ONLINE rac-26ai1 READ WRITE,STABLE
2 ONLINE ONLINE rac-26ai2 READ WRITE,STABLE
ora.orcl.pdb02.pdb
1 ONLINE ONLINE rac-26ai1 READ WRITE,STABLE
2 ONLINE ONLINE rac-26ai2 READ WRITE,STABLE
--------------------------------------------------------------------------------

Through this operation, a resource named ora.orcl.pdb02.pdb is generated, and its status can be verified via crsctl.

Implementation: Deletion and Cleanup on Actual 26ai System

When deleting, the correct “Oracle PDB Deletion Procedure” to prevent inconsistency is to delete the GI resource first before executing the SQL.

1. Stopping and Removing the Resource

Stop and remove (unregister) the resource to take it out of GI management.

[oracle@rac-26ai1 ~]$ srvctl stop pdb -db orcl -pdb pdb02
[oracle@rac-26ai1 ~]$ srvctl remove pdb -db orcl -pdb pdb02
Remove the PDB pdb02? (y/[n]) y
[oracle@rac-26ai1 ~]$ /u01/app/23.0.0/grid/bin/crsctl stat res -w "TYPE = ora.pdb.type" -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.orcl.pdb01.pdb
1 ONLINE ONLINE rac-26ai1 READ WRITE,STABLE
2 ONLINE ONLINE rac-26ai2 READ WRITE,STABLE
--------------------------------------------------------------------------------

2. Physical Deletion of the PDB

Finally, delete the database itself and the data files via SQL*Plus.

-- Execute after confirming it is in MOUNTED state
SQL> drop pluggable database pdb02 including datafiles;

Pluggable database dropped.

Troubleshooting: Representative Errors and Resolutions

SituationCauseResolution
PRCD-1120 / PRCD-1131Specified PDB name does not exist in CDBRe-verify the name and spelling using show pdbs.
*CRS-4037 ( error)**Using wildcards with crsctlUse -w "TYPE = ora.pdb.type" to filter the output.
Cannot register resourceA PDB resource with the same name already existsCheck if it is already registered with srvctl config pdb.

Operational and Security Notes

  • Management Inconsistency Risk: If you forget to execute srvctl add pdb after creating it with SQL, the PDB will not open automatically when the CDB is restarted. In a RAC environment, ensure that the rule “PDB creation and resource registration are a set” is strictly followed.
  • Scope of Impact and Reversion:
    • Impact: DROP...INCLUDING DATAFILES is irreversible. Always ensure you have a valid backup via RMAN or other means before execution.
    • Reversion: If you accidentally delete the GI resource (srvctl remove), metadata can be reconstructed by executing srvctl add pdb again (the data itself will not be lost).

FAQ: Frequently Asked Questions

Q1. What is the benefit of creating with SQL instead of DBCA (GUI)? A1. It is extremely effective for automating construction via shell scripts or for utilizing high-speed clones of existing PDBs (such as Snapshot Copies).

Q2. The created PDB only starts on some nodes. A2. Execute srvctl start pdb. The SQL statement ALTER PLUGGABLE DATABASE OPEN only affects the instance where it was executed.

Q3. What are the execution privileges for srvctl add pdb? A3. It is typically executed by the database owner (oracle user). Since it involves TYPE operations on the Grid Infrastructure side, environment variables must be correctly set.

Summary: Oracle 26ai PDB Operations

  • Creation Procedure: 3 steps — SQL execution → srvctl addsrvctl start.
  • Deletion Procedure: 3 steps — srvctl stopsrvctl remove → SQL execution (DROP).
  • Status Verification: Collective monitoring is possible with crsctl stat res -w "TYPE = ora.pdb.type" -t.

[reference]
Administering Database Instances and Cluster Databases

This article explains the process targeting Oracle Database 26ai (23.26.1). (In other versions like 19c, the resource type name may be ora.pluggable_database.type).

コメント

Copied title and URL