The concept of a multitenant database was introduced in Oracle database 12c. The multitenant architecture enables an Oracle database to function as a multitenant container database (CDB) that houses pluggable databases (PDB).
A PDB is a portable collection of schemas, schema objects, and nonschema objects that appears to an Oracle Net client as a non-CDB. All Oracle databases before Oracle Database 12c were non-CDBs. There’re several awesome feature in the Oracle multenant setup. This blogs details one of those cool features, the ability to easily rename a pluggable database … no NID or complicated mess necessary. Also check out my github sql and shell scripts to rename PDB.
Rename A PDB
Connect to the CDB as SYS and close the PDB
SQL> ALTER pluggable DATABASE myoldpdb CLOSE IMMEDIATE;
Restart the PDB in “RESTRICTED” mode
SQL> ALTER pluggable DATABASE myoldpdb OPEN restricted;
Connect to the PDB
SQL> ALTER SESSION SET container=myoldpdb;
Rename PDB
SQL> ALTER pluggable DATABASE myoldpdb RENAME global_name TO mynewpdb;
Restart PDB. No need to specify the PDB name since you are connected directly to the PDB
SQL> ALTER pluggable DATABASE CLOSE IMMEDIATE;
SQL> ALTER pluggable DATABASE OPEN;