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!!!
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.