Renaming a Pluggable Database (PDB)

I’ve been working on a few scripts that will be used to build new CDB/PDB environments.  At the last minute, the client requested that the PDB names be specific and enumerated.  So this got me thinking, is there a way to rename a Pluggable Database (PDB) after it has been built?  The answer is yes!  

Former co-worker at Oracle, Mike Detrick documents the process over on his blog as well (here).  This brief write up will serve as a reminder to the topic as well.

To rename an Oracle Pluggable Database, the following has to be done:

1. Take the Oracle Pluggable Database offline

$ sqlplus / as sysdba
SQL > alter pluggable database <NAME> close;
SQL> alter pluggable database <NAME> open restricted;

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 OGGTST READ WRITE YES

2. Connect to the PDB and rename the PDB

SQL> alter session set container=OGGTST;
SQL> alter pluggable database rename global_name to TESTPDB;

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 TSTPDB READ WRITE YES

3. Bring the renamed PDB back online

SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database TSTPDB close;
SQL> alter pluggable database TSTPDB open read write;

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TSTPDB READ WRITE NO

Please note that when you change the PDB name, its underlying directory structure will not change.  

Enjoy!!!

Please follow and like:

Leave a Reply

Your email address will not be published.

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.