Configuring a PDB to Listen on a Specific RAC Node in Oracle Database
In Oracle Real Application Clusters (RAC) environments, you may need to restrict a Pluggable Database (PDB) to run on specific nodes. Here’s how to configure PDB MYPDB to listen only on node1:
Step-by-Step Configuration
1. Configure the PDB State on Node 1
First, ensure the PDB is open on your preferred node and save that state:
-- Connect to the PDB on Node 1
ALTER SESSION SET CONTAINER = MYPDB;
-- Open the PDB if it's not already open
ALTER PLUGGABLE DATABASE OPEN;
-- Save the open state for future restarts
ALTER PLUGGABLE DATABASE SAVE STATE;
The SAVE STATE command ensures the PDB will automatically open when the CDB starts on this node.
2. Configure the PDB State on Node 2
Next, explicitly close the PDB on other nodes and discard any saved state:
-- Connect to the PDB on Node 2
ALTER SESSION SET CONTAINER = MYPDB;
-- Close the PDB immediately
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
-- Discard any saved state for this PDB on Node 2
ALTER PLUGGABLE DATABASE DISCARD STATE;
The DISCARD STATE command removes any previously saved state, preventing the PDB from automatically opening on this node.
3. Configure the Service for Node Affinity
Finally, modify the service to ensure it only runs on your preferred node:
srvctl modify service -db node1 -service node1_mypdb.paas.oracle.com \
-modifyconfig -preferred node1 -available ""
This command:
– Sets node1 as the preferred node for the service
– Removes any available nodes (empty string after -available)
– Ensures the service (and thus the PDB) will only run on node1
Verification
After making these changes, verify your configuration:
-
Check PDB status on each node:
sql
SELECT inst_id, name, open_mode FROM gv$pdbs; -
Verify service configuration:
bash
srvctl config service -db node1 -service node1_mypdb.paas.oracle.com
Important Notes
- This configuration is particularly useful for:
- License optimization (running certain PDBs only on licensed nodes)
- Performance isolation
- Workload separation
- Remember that in a RAC environment, the PDB files must still be accessible from all nodes
- The service name (
node1_mypdb.paas.oracle.com) should match your actual service name
Would you like me to elaborate on any specific aspect of this configuration?
