
7 Steps to Rename Oracle Standard Edition PDBs
What is the difference in renaming an Enterprise Edition PDB vs a Standard Edition PDB? The actual process of renaming the PDB is identical in both editions. However an important steps, that is also optional, is different. When you rename a database, you want the datafile names to be consistent, otherwise things would be messy. This step, renaming the datafiles is different between the two editions. Last week we looked at how to rename datafiles for an Oracle database that is Standard Edition.
So the purpose of this post today is to show you how you rename a PDB database for Oracle Standard Edition, including the datafile renames.
First I’ll go through the high level steps, and then I’ll give you the statements to executed them!
In this example we will rename a PDB, from OLDPDB to NEWPDB. Please note all steps were executed on Oracle 19c Standard Edition!
- Gather information: datafile names, service names, database name
- Close the PDB and open it in restricted mode
- Rename the PDB database by changing the global_name
- Close the PDB and rename the datafiles
- Open the PDB in normal mode
- Drop and add the TEMP file with the new name
- Run verification steps: datafile names, service names, database name
Now that you are familiar with the steps, let’s see how we go about them!
- Gather information: datafile names, service names, database name
alter session set container=OLDPDB;
select name from dba_services;
NAME
--------------
OLDPDB
select file_name from dba_data_files;
FILE_NAME
---------------------------------------
/u01/oradata/cdb1/OLDPDB/SYSTEM01.DBF
/u01/oradata/cdb1/OLDPDB/SYSAUX01.DBF
/u01/oradata/cdb1/OLDPDB/UNDOTBS01.DBF
/u01/oradata/cdb1/OLDPDB/USERS01.DBF
/u01/oradata/cdb1/OLDPDB/DATA01.DBF
/u01/oradata/cdb1/OLDPDB/INDX01.DBF
select file_name from dba_temp_files;
FILE_NAME
---------------------------------------
/u01/oradata/cdb1/OLDPDB/TEMP01.DBF
2. Close the PDB and open it in restricted mode
alter pluggable database OLDPDB close immediate;
Pluggable database altered.
alter pluggable database OLDPDB open restricted;
Pluggable database altered.
show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------- ---------- ----------
2 PDB$SEED READ ONLY NO
3 OLDPDB READ WRITE YES
3. Rename the PDB database by changing the global_name
alter pluggable database OLDPDB rename global_name to NEWPDB;
Pluggable database altered.
show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ----------------- ---------- ----------
3 NEWPDB READ WRITE YES
- Close the PDB and rename the datafiles. Here is the different step. Starting with 12c, you could rename and move files online. If you are using Oracle Standard Edition, that is not the case, that is not available to you. You must use the old way, and manually move and rename the files.
alter pluggable database NEWPDB close immediate;
mkdir /u01/oradata/cdb1/NEWPDB
mv /u01/oradata/cdb1/OLDPDB/* /u01/oradata/cdb1/NEWPDB/.
sqlplus / as sysdba
alter session set container=NEWPDB;
alter database rename file '/u01/oradata/cdb1/OLDPDB/SYSTEM01.DBF' to '/u01/oradata/cdb1/NEWPDB/SYSTEM01.DBF';
alter database rename file '/u01/oradata/cdb1/OLDPDB/SYSAUX01.DBF' to '/u01/oradata/cdb1/NEWPDB/SYSAUX01.DBF';
alter database rename file '/u01/oradata/cdb1/OLDPDB/UNDOTBS01.DBF' to '/u01/oradata/cdb1/NEWPDB/UNDOTBS01.DBF';
alter database rename file '/u01/oradata/cdb1/OLDPDB/USERS01.DBF' to '/u01/oradata/cdb1/NEWPDB/USERS01.DBF';
alter database rename file '/u01/oradata/cdb1/OLDPDB/DATA01.DBF' to '/u01/oradata/cdb1/NEWPDB/DATA01.DBF';
alter database rename file '/u01/oradata/cdb1/OLDPDB/INDX01.DBF' to '/u01/oradata/cdb1/NEWPDB/INDX01.DBF';
5. Open the PDB in normal mode
alter pluggable database OLDPDB open;
6. Drop and add the TEMP file with the new name
alter database tempfile '/u01/oradata/cdb1/OLDPDB/TEMP01.DBF' drop including datafiles;
alter tablespace TEMP add tempfile '/u01/oradata/cdb1/NEWPDB/TEMP01.DBF' size 1G autoextend on next 10M maxsize 31G;
7. Run verification steps: datafile names, service names, database name
alter session set container=NEWPDB;
select name from dba_services;
NAME
--------------
NEWPDB
select file_name from dba_data_files;
FILE_NAME
---------------------------------------
/u01/oradata/cdb1/NEWPDB/SYSTEM01.DBF
/u01/oradata/cdb1/NEWPDB/SYSAUX01.DBF
/u01/oradata/cdb1/NEWPDB/UNDOTBS01.DBF
/u01/oradata/cdb1/NEWPDB/USERS01.DBF
/u01/oradata/cdb1/NEWPDB/DATA01.DBF
/u01/oradata/cdb1/NEWPDB/INDX01.DBF
select file_name from dba_temp_files;
FILE_NAME
---------------------------------------
/u01/oradata/cdb1/NEWPDB/TEMP01.DBF
That is your 7 step plan to rename an Oracle PDB Standard Edition!