Search This Blog

Total Pageviews

Monday, 2 March 2026

How to Rename a Pluggable Database



How to Rename a Pluggable Database (PDB) in Oracle 19c

Renaming a PDB involves switching to a restricted mode, updating the global name, and restarting the PDB to register the new service names with the listener.

Prerequisites

  • Access to the CDB as a user with SYSDBA privileges.

  • A brief maintenance window (the PDB must be closed/opened in restricted mode).

Step 1: Check Current PDB Status

First, verify the current name and state of your PDBs.

SQL
SQL> show pdbs;

Step 2: Close and Reopen in Restricted Mode

You cannot rename a PDB while it is open for general use. Close it and then reopen it in RESTRICTED mode.

SQL
SQL> alter pluggable database ORCL close;
SQL> alter pluggable database ORCL open restricted;

Step 3: Switch Container and Rename

Switch your session context to the PDB you wish to rename and execute the rename global_name command.

SQL
SQL> alter session set container=ORCL;
SQL> alter pluggable database rename global_name to ORCL19;

Step 4: Verify the Change

Run the show pdbs command again to confirm the name change. Note that the PDB will still be in restricted mode at this stage.

SQL
SQL> show pdbs;
-- Result: ORCL19 | READ WRITE | YES

Step 5: Restart the PDB to Update Services

To ensure the Oracle Listener recognizes the new service name and to lift the restricted status, restart the PDB.

SQL
SQL> alter pluggable database close immediate;
SQL> alter pluggable database open;

Step 6: Verify Listener Services

Finally, check that the new service is registered with the listener using the lsnrctl utility.

ALTER SYSTEM REGISTER;

SQL> !lsnrctl services

Key Takeaways for Your Readers:

  • Service Names: When you rename a PDB, the default service name changes to match the new PDB name.

  • Connectivity: Ensure you update your tnsnames.ora or connection strings on the application side to reflect the new name (ORCL19).

  • Metadata: This process updates the control file and the data dictionary of the PDB.

No comments:

Oracle DBA

anuj blog Archive