There might be a situation when
you created a pluggable database with the wrong name then it's not time to
worry, you can simply rename it using rename command, in another situation
where the client requested to change the name of the pluggable database, then
rename command will to amazing work. Here we will discuss renaming oracle PDB
Below are the pluggable database present in my system I want to rename technopdb3 to technopdb2
Below are steps to perform it
The first step is to close the pluggable
database
SQL> alter pluggable database technopdb3 close immediate;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME
OPEN MODE
RESTRICTED
---------- ------------------------------
---------- ----------
2 PDB$SEED
READ ONLY NO
3 TECHNOPDB
READ
WRITE NO
4 TECHNOPDB3
MOUNTED
5
TECHNOPDB_NEW
READ WRITE NO
SQL>
pluggable database technopdb3 has
been closed, now open same pluggable database in restricted mode
SQL> alter pluggable database technopdb3 open
restricted;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME
OPEN MODE RESTRICTED
---------- ----------------------------- ----------
----------
2 PDB$SEED
READ ONLY NO
3 TECHNOPDB
READ
WRITE NO
4 TECHNOPDB3
READ WRITE YES
5
TECHNOPDB_NEW
READ WRITE NO
now connect to pluggable database
using alter session command and execute rename command as mentioned below
SQL> alter session set container=technopdb3;
Session altered.
SQL> alter pluggable database technopdb3 rename global_name to technopdb2;
Pluggable database altered.
Now close the pluggable database
and open in normal mode
SQL> alter pluggable database close;
Pluggable database altered.
SQL> alter pluggable database open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME
OPEN MODE RESTRICTED
---------- ----------------------------- ----------
----------
2 PDB$SEED
READ ONLY NO
3 TECHNOPDB
READ
WRITE NO
4 TECHNOPDB2
READ WRITE NO
5 TECHNOPDB_NEW
READ WRITE NO
SQL>
In this way, technopdb3 has been renamed to technopdb2