8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Multitenant : Rename a Pluggable Database (PDB)
From Oracle database 12.1.0.2 onward we can rename a pluggable database (PDB).
Related articles.
Prepare the Pluggable Database (PDB)
Check the current name of the user defined PDB.
conn / as sysdba show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO SQL>
Switch to the PDB and check the names of the datafiles.
alter session set container = pdb1; select name from v$datafile; NAME -------------------------------------------------------------------------------- /u02/oradata/CDB1/pdb1/system01.dbf /u02/oradata/CDB1/pdb1/sysaux01.dbf /u02/oradata/CDB1/pdb1/undotbs01.dbf /u02/oradata/CDB1/pdb1/users01.dbf /u02/oradata/CDB1/EFB4284A464F52E3E055000000000001/datafile/o1_mf_apex_ksjoblv5_.dbf
We close the PDB and open it in restricted mode.
conn / as sysdba alter pluggable database pdb1 close; alter pluggable database pdb1 open restricted;
Rename the Pluggable Database (PDB)
We switch to the PDB and rename the global name.
alter session set container=pdb1; alter pluggable database rename global_name to pdb2;
We restart the PDB and display the PDB name.
alter pluggable database close immediate; alter pluggable database open; SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 3 PDB2 READ WRITE NO SQL>
We can see this has no impact on the paths or names of the data files.
select name from v$datafile; NAME -------------------------------------------------------------------------------- /u02/oradata/CDB1/pdb1/system01.dbf /u02/oradata/CDB1/pdb1/sysaux01.dbf /u02/oradata/CDB1/pdb1/undotbs01.dbf /u02/oradata/CDB1/pdb1/users01.dbf /u02/oradata/CDB1/EFB4284A464F52E3E055000000000001/datafile/o1_mf_apex_ksjoblv5_.dbf SQL>
If we want to alter them, we can perform an online move of the data files, as described here.
For more information see:
- ALTER PLUGGABLE DATABASE
- Rename a Pluggable Database In Oracle 12c (Doc ID 2439885.1)
- Online Move Datafile in Oracle Database 12c Release 1 (12.1)
- Multitenant : All Articles
Hope this helps. Regards Tim...