Rename a PDB in Oracle Database Multitenant Architecture
I am sharing a step-by-step guide to help you rename a PDB. This approach uses SQL commands.
Without TDE or encryption Wallet
Initial Check
Check the Current Database Name and Open Mode:
List Current PDBs:
Steps to Rename the PDB
Step 1: Export ORACLE_SID
Set the Oracle SID to the Container Database (CDB):
Step 2: Verify Target PDB Name Availability
If the target PDB name is different from the current PDB name, ensure no service exists with the target PDB name.
Run SQL to Check Existing Services:
If the result is 0
, proceed to the next step. Otherwise, delete the service.
Delete Existing Service (if needed):
Step 3: Rename the PDB
Close the Source PDB:
Unplug the PDB:
Drop the PDB:
Create the New PDB:
Use the NOCOPY
option to reuse the existing data files:
Open the New PDB in Read/Write Mode:
Step 4: Verify the Renamed PDB
List the PDBs to Confirm the Name Change:
Ensure the PDB Name Adheres to Restrictions:
PDB names should not exceed 8 characters.Step 5: Save the State of the PDB
Start the PDB and Save its State: For a single-node database:
SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE;
For an Oracle RAC database:
SQL> ALTER PLUGGABLE DATABASE ALL OPEN INSTANCES=ALL;
SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE INSTANCES=ALL;
$ sqlplus / as sysdba @adupdlib.sql <libext>
Output Execution
Below is an example of the process in action:
With TDE or encryption Wallet
Step 1: Close the Auto-login Wallet
Step 2: Export Encryption Keys
Step 3: Rename the PDB
Step 4: Import Encryption Keys
Step 5: Re-enable Auto-login Wallet
Step 6: Update Libraries
Post-verification
Notes
- Always take a full backup before making significant changes.
- Ensure all applications are updated to point to the new PDB name.
- Adjust TNS entries if necessary.
Please do like and subscribe to my youtube channel: https://www.youtube.com/@foalabs If you like this post please follow,share and comment
Post a Comment
Post a Comment