Home Administration How to rename a PDB in 19c

How to rename a PDB in 19c

Let’s look at how to rename a PDB in 19c. The steps are the same as 12c. Per Oracle note referenced below, you must have the ALTER DATABASE privilege, either granted commonly or granted locally in the PDB. You must also have the RESTRICTED SESSION privilege, either granted commonly or granted locally in the PDB being renamed, and the PDB must be in READ WRITE RESTRICTED mode.

Here we will rename an initial PDB (INIPDB) to a development PDB (DEVPDB).

Restricted mode

Open the pluggable database in restricted mode.

SQL*Plus: Release 19.0.0.0.0 - Production on Fri May 22 17:52:52 2020
Version 19.6.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 INIPDB 			  READ WRITE NO


SQL> alter pluggable database inipdb close immediate instances=all;

Pluggable database altered.

SQL> alter pluggable database inipdb open read write restricted;

Pluggable database altered.

Rename

Rename the PDB’s global name. You should set the current container to the PDB you are renaming.

SQL> alter session set container=inipdb;

Session altered.

SQL> alter pluggable database inipdb rename global_name to devpdb;

Pluggable database altered.

Open

Close the renamed PDB and open in read-write mode on all instances.

SQL> alter session set container=cdb$root;

Session altered.

SQL> alter pluggable database devpdb close immediate;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 DEVPDB			  MOUNTED

SQL> alter pluggable database devpdb open read write instances=all;

Pluggable database altered.

SQL> set lines 200
SQL> col name for a20
SQL> select inst_id, name, open_mode, restricted from gv$pdbs order by 1,2;

   INST_ID NAME 		OPEN_MODE  RES
---------- -------------------- ---------- ---
	 1 DEVPDB		READ WRITE NO
	 1 PDB$SEED		READ ONLY  NO
	 2 DEVPDB		READ WRITE NO
	 2 PDB$SEED		READ ONLY  NO

Default Service

Changing the global name should change the default service name to match the new PDB name.

SQL> alter session set container=DEVPDB;

Session altered.

-- PDB's Default Service
SQL> select name from dba_services;

NAME
--------------------
DEVPDB

Reference

SQL Language Reference – 19c

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest posts

How to rename a PDB in 19c

Let's look at how to rename a PDB in 19c. The steps are the same as 12c....

How to change the ethernet switch password on Exadata

Let's look at how to log in and change the ethernet switch (adm) password on an Exadata...

Install Oracle GoldenGate Plug-in on Oracle Enterprise Manager Cloud Control 13c

In this post, we will install and deploy Oracle GoldenGate Plug-in 13.4.1.0 on Oracle Enterprise Manager Cloud...

Fixed – EXPDP – OS/ Wallet Authentication does not work, prompts for password

I recently encountered a strange issue on a newly created multitenant database on 19.6 version. Our EXPDP...

You might also likeRELATED
Recommended to you