Renaming a Pluggable Database (PDB) in Oracle Multitenant may seem like a small administrative task, but doing it correctly is crucial for maintaining a clean and well-organized database environment. Whether you're restructuring your naming conventions, preparing for a migration, or correcting a misconfigured setup, Oracle provides a reliable method to rename a PDB with minimal downtime.
In this guide, we will walk through the exact steps required to safely rename a PDB in an Oracle Multitenant architecture, ensuring the process is smooth, error-free, and aligned with Oracle best practices.
Step 1: Connect to the PDB and check its state.
SQL> alter session set container=ORCLPDB; Session altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 ORCLPDB READ WRITE NO
Step 2: Close the PDB and open it in restricted mode.
SQL> alter pluggable database ORCLPDB close;
Pluggable database altered.
SQL> alter pluggable database ORCLPDB open restricted;
Pluggable database altered.
Step 3: Connect to the PDB and change its name.
SQL> alter session set container=ORCLPDB; Session altered. SQL> alter pluggable database rename global_name to TESTPDB; Pluggable database altered.
Step 4: Restart the PDB and check the name.
SQL> alter pluggable database close immediate; Pluggable database altered. SQL> alter pluggable database open; Pluggable database altered. SQL> alter pluggable database save state; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 TESTPDB READ WRITE NO
The name of the pluggable database has been successfully changed from ORCLPDB to TESTPDB following a few straightforward steps.
