Multitenant : Rename a Pluggable Database (PDB)
Prepare the Pluggable Database (PDB)
Check the current name of the user defined PDB.
sqlplus / 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.
SQL> alter session set container = pdb1;
SQL> 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.
SQL> conn / as sysdba
SQL> alter pluggable database pdb1 close;
SQL> alter pluggable database pdb1 open restricted; Rename the Pluggable Database (PDB) We switch to the PDB and rename the global name.
SQL> alter session set container=pdb1;
SQL> alter pluggable database rename global_name to pdb2; We restart the PDB and display the PDB name.
SQL> alter pluggable database close immediate; SQL> 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.
SQL> 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.
All rights reserved