DBA Hub

📋Steps in this guide1/2

Multitenant : Rename a Pluggable Database (PDB)

From Oracle database 12.1.0.2 onward we can rename a pluggable database (PDB).

oracle 12cconfigurationintermediate
by OracleDba
12 views
1

Prepare the Pluggable Database (PDB)

Check the current name of the user defined PDB. Switch to the PDB and check the names of the datafiles. We close the PDB and open it in restricted mode.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
conn / as sysdba

show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
SQL>

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

conn / as sysdba

alter pluggable database pdb1 close;

alter pluggable database pdb1 open restricted;
2

Rename the Pluggable Database (PDB)

We switch to the PDB and rename the global name. We restart the PDB and display the PDB name. We can see this has no impact on the paths or names of the data files. If we want to alter them, we can perform an online move of the data files, as described here . For more information see: Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
alter session set container=pdb1;

alter pluggable database rename global_name to pdb2;

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>

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>

Comments (0)

Please to add comments

No comments yet. Be the first to comment!