Guide to Modify Pluggable CDB Name, PDB Name, and DBID in Oracle 18c Multitenant Architecture

    By: Emad Al-Mousa on Apr 03, 2019

    Modify Pluggable DB.png

    By Emad Al-Mousa | Edited by Mike Gangler

    Oracle’s Multitenant option was introduced in 12c Release as an efficient response to the cloud technology challenges by reducing costs, streamlining processes and managing resources effectively. The architectural model consists of a container database (CDB) that controls the instance-wide maintenance activities and contains zero or more isolated pluggable databases (PDB) independently managed in terms of resources and security.

    Initially, Oracle did not enforce the model, but kept the legacy structures (the older non-CDB instances) intact. But recently, the non-CDB option was deprecated, a decision that drives Oracle users to start adopting and converting their infrastructure to the new option. In turn, this posed several challenges of its own, one of which is changing the PDB level name, CDB name, or database ID (DBID).

    One possible use case is when a backup file of a PDB is received from a third-party software vendor whose name needs to change to meet the organization’s naming standards, or to better convey the purposes of the database. Another scenario is to change the DBID of a cloned database to maintain its unique backup information repository in recovery catalog. In these and similar situations, we can follow the methods explained below to achieve the required modifications. 

    In this article, I will provide detailed steps for three different changes that can be implemented in your multitenant architecture CDB environment:

    • Changing PDB name
    • Changing CDB name
    • Changing Oracle DBID for all PDBs

    Please note these changes may have consequences such as impacting backup and recovery. They should not be deployed in a production environment without proper planning and thorough testing.

     

    Changing Pluggable Database Name

    Accessing through CDB$root execute the following:

     

    SQL> alter pluggable database PDB_TEST2 close;

    SQL> alter pluggable database PDB_TEST2 open restricted;

    SQL> select name, open_mode, restricted from V$PDBS where name='PDB_TEST2';

    PluggableDB_1.png

    Connect to the pluggable database PDB_TEST2 and execute the following:

    SQL> alter session set container=PDB_TEST2;

    SQL> alter pluggable database rename global_name to PDB_X;

    SQL> alter pluggable database close immediate;

    SQL> alter pluggable database open;

    PluggableDB_2.png 

    As shown below the pluggable database name has changed successfully:

    PluggableDB_3.png

    One last thing to consider, the data files will be kept as is on the old directory pluggable database name. This can be checked by executing the following SQL query:

    SQL> select * from DBA_DATA_FILES;

     

    If you want to change this, then create another sub-directory and use the SQL command alter database move datafile.

     

    Changing Oracle CDB Name

    My current oracle CDB name is set to oracle

    PluggableDB_4.png

    Connect to the CDB$ROOT and execute the following:

    SQL> SHUTDOWN IMMEDIATE

    SQL> STARTUP MOUNT

     

    Open a new session and execute the following command for nid utility:

    nid TARGET=SYS DBNAME=oracle18

    PluggableDB_5.png

    Final message showing successful execution:

    PluggableDB_6.png

    SQL> STARTUP NOMOUNT

    SQL> alter system set db_name='oracle18' scope=spfile;

    SQL> alter database mount;

    SQL> ALTER DATABASE OPEN RESETLOGS;

     

    To verify:

    SQL> select * from V$DATABASE;

    PluggableDB_7.png

     

    Changing Oracle DB ID

    SQL> SHUTDOWN IMMEDIATE

    SQL> STARTUP MOUNT

     

    Open a new session and use DBNEWID. Specify the parameter PDB=ALL to change all pluggable database IDs:

    nid TARGET=SYS PDB=ALL

     

    PluggableDB_8.png

    PluggableDB_9.png

    SQL> STARTUP MOUNT

    SQL> ALTER DATABASE OPEN RESETLOGS;

     

    To Compare before and after DBID values for PDB_X pluggable database:

    Before:

    PluggableDB_10.png

    After:

    PluggableDB_11.png

    Conclusion 

    The multitenant option (MO) offers immense advantages related to cost and resource management when implemented. Once implemented, some old issues need to be tackled in new ways. One of those is manipulating the “identity” of a database, its name and ID. The operational and organizational drivers for this change include conformity to standards and providing uniqueness to cloned databases. The article traced the procedures to perform in order to alter the identifiers of the MO components. It presented the steps needed to modify the CDB and PDB names, as well as the DBID’s for the pluggable databases. It also illustrated the usage of the DBNEWID Utility in a multitenant environment and the commands to complete the modifications.

    A final note: one possible area of enhancement to the DBID modification process is to enable it to be executed on individual PDB level. This will increase the degree of flexibility of the “pluggable” nature of the PDBs.

     


     

    Emad_Pic.pngEmad Al-Mousa is a senior system analyst at Saudi Aramco, and has been working with Oracle technologies since 2006. He is an expert with the Oracle Database platform in different areas such as high availability, security, and performance tuning. In addition, he is an expert with Oracle spatial technology for GIS systems. Emad posseses multiple Oracle Database Certifications.



    Copyright © 2019 Communication Center. All Rights Reserved
    All material, files, logos and trademarks within this site are properties of their respective organizations.
    Terms of Service - Privacy Policy - Contact

    Independent Oracle Users Group
    330 N. Wabash Ave., Suite 2000, Chicago, IL 60611
    phone: 312-245-1579 | email: ioug@ioug.org

    IOUG Logo

    Copyright © 1993-2019 by the Independent Oracle Users Group
    Terms of Use | Privacy Policy