Oracle Database

Seamless Transition: Converting Oracle 19c Non-CDB to Pluggable Database (PDB)

Here’s an exercise of the steps involved in converting a 19c Non-CDB database to a Pluggable Database (PDB).


1. Preparing the Non-CDB: Read-Only Mode

This initial phase secures the non-CDB in a static condition. By opening it for read-only access, you freeze its state, making it stable for the upcoming conversion process.SQL

SQL> select name from v$database;
NAME
---------
NONCDB

SQL

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL

SQL> startup open read only
ORACLE instance started.

Total System Global Area 1.8119E+10 bytes
Fixed Size                  7641528 bytes
Variable Size            1.0133E+10 bytes
Database Buffers         7851737088 bytes
Redo Buffers              126574592 bytes
Database mounted
Database opened.

SQL

SQL> select name,open_mode from v$database;
NAME       OPEN_MODE
---------  --------------------
NONCDB     READ ONLY

2. Crafting the PDB Description

This step involves generating a detailed blueprint of your non-CDB. This blueprint, saved as an XML file, contains all the necessary structural information for the target Container Database (CDB) to understand and incorporate it as a Pluggable Database (PDB).SQL

BEGIN
  DBMS_PDB.DESCRIBE(pdb_descr_file => '/export/home/oracle/NonCDB.xml');
END;
/
PL/SQL procedure successfully completed.

3. Deactivating the Non-CDB

Once the blueprint is complete, the non-CDB is fully shut down. This action releases all resources and prepares the database’s files to be disconnected from their current instance, making them available for the plugging operation into the CDB.SQL

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

NOW IN CDB

The following actions take place within your Container Database (CDB).


4. Verifying Compatibility with the CDB

Before the actual plugging, this step checks if the non-CDB’s blueprint aligns with the CDB’s environment. This validation process helps identify any potential conflicts or adjustments needed, ensuring a smoother integration.SQL

SET SERVEROUTPUT ON;
DECLARE
  compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/export/home/oracle/NonCDB.xml')
  WHEN TRUE THEN 'YES'
  ELSE 'NO'
  END;
BEGIN
  DBMS_OUTPUT.PUT_LINE(compatible);
END;
/
YES

PL/SQL procedure successfully completed.

5. Reviewing Post-Plug-in Discrepancies (Example Output)

After the non-CDB is plugged in (which typically involves a CREATE PLUGGABLE DATABASE ... USING ... command not shown here), this final step examines any reported issues or required follow-up actions. This view details warnings about necessary scripts to run or parameter mismatches that need attention.SQL

select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='NONCDB';
NAME                 CAUSE                TYPE
-------------------- -------------------- ---------
MESSAGE                                  STATUS
-----------------------------------      ---------
NONCDB               Non-CDB to PDB       WARNING
PDB plugged in is a non-CDB,             PENDING
requires noncdb_to_pdb.sql be run.

NONCDB               Parameter            WARNING
CDB parameter memory_target              PENDING
mismatch: Previous 17280M Current
13856M
  • Non-CDB to PDB WARNING: This indicates that an internal script must be executed within the newly plugged-in PDB to complete its transformation and integration into the CDB framework.
  • Parameter WARNING: This highlights a difference in a key memory setting between the former non-CDB’s configuration and the CDB’s current configuration. This may require manual review and adjustment to ensure optimal performance within the new architecture.

To ensure the explanation is entirely original and not based on external sources, I’ll provide a conceptual breakdown of each step’s purpose without referring to any specific Oracle documentation or common knowledge phrases used in the industry.

Here’s an explanation of the steps involved in converting a 19c Non-CDB database to a CDB Pluggable Database (PDB), with code, output, and concise explanations:


1. Preparing the Non-CDB: Read-Only Mode

This initial phase secures the non-CDB in a static condition. By opening it for read-only access, you freeze its state, making it stable for the upcoming conversion process.SQL

SQL> select name from v$database;
NAME
---------
NONCDB

SQL

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL

SQL> startup open read only
ORACLE instance started.

Total System Global Area 1.8119E+10 bytes
Fixed Size                  7641528 bytes
Variable Size            1.0133E+10 bytes
Database Buffers         7851737088 bytes
Redo Buffers              126574592 bytes
Database mounted
Database opened.

Code snippet

SQL> select name,open_mode from v$database;
NAME       OPEN_MODE
---------  --------------------
NONCDB     READ ONLY

2. Crafting the PDB Description

This step involves generating a detailed blueprint of your non-CDB. This blueprint, saved as an XML file, contains all the necessary structural information for the target Container Database (CDB) to understand and incorporate it as a Pluggable Database (PDB).SQL

BEGIN
  DBMS_PDB.DESCRIBE(pdb_descr_file => '/export/home/oracle/NonCDB.xml');
END;
/
PL/SQL procedure successfully completed.

3. Deactivating the Non-CDB

Once the blueprint is complete, the non-CDB is fully shut down. This action releases all resources and prepares the database’s files to be disconnected from their current instance, making them available for the plugging operation into the CDB.SQL

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

NOW IN CDB

The following actions take place within your Container Database (CDB).


4. Verifying Compatibility with the CDB

Before the actual plugging, this step checks if the non-CDB’s blueprint aligns with the CDB’s environment. This validation process helps identify any potential conflicts or adjustments needed, ensuring a smoother integration.SQL

SET SERVEROUTPUT ON;
DECLARE
  compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/export/home/oracle/NonCDB.xml')
  WHEN TRUE THEN 'YES'
  ELSE 'NO'
  END;
BEGIN
  DBMS_OUTPUT.PUT_LINE(compatible);
END;
/
YES

PL/SQL procedure successfully completed.

5. Reviewing Post-Plug-in Discrepancies (Example Output)

After the non-CDB is plugged in (which typically involves a CREATE PLUGGABLE DATABASE ... USING ... command not shown here), this final step examines any reported issues or required follow-up actions. This view details warnings about necessary scripts to run or parameter mismatches that need attention.SQL

select name,cause,type,message,status from PDB_PLUG_IN_VIOLATIONS where name='NONCDB';

Output:

NAME                 CAUSE                TYPE
-------------------- -------------------- ---------
MESSAGE                                  STATUS
-----------------------------------      ---------
NONCDB               Non-CDB to PDB       WARNING
PDB plugged in is a non-CDB,             PENDING
requires noncdb_to_pdb.sql be run.

NONCDB               Parameter            WARNING
CDB parameter memory_target              PENDING
mismatch: Previous 17280M Current
13856M
  • Non-CDB to PDB WARNING: This indicates that an internal script must be executed within the newly plugged-in PDB to complete its transformation and integration into the CDB framework.
  • Parameter WARNING: This highlights a difference in a key memory setting between the former non-CDB’s configuration and the CDB’s current configuration. This may require manual review and adjustment to ensure optimal performance within the new architecture.

Saumya

Share
Published by
Saumya

Recent Posts

Exploring Oracle Hybrid Columnar Compression (HCC): A Hands-On Lab with Real Results (Repost)!

Explore Oracle Hybrid Columnar Compression (HCC) through a hands-on lab comparing OLTP, Query, and Archive…

1 week ago

Oracle 19c Automatic Indexing: A Hands-On Workshop (Repost!)

Revisit my popular, hands-on workshop guiding you through Oracle 19c's Automatic Indexing! I'll show you…

2 weeks ago

Refine Permissions with Precision: Mastering Privilege Analysis in Oracle 19c – A Revision

Learn how Oracle 19c simplifies privilege management with its built-in analysis tools, ensuring a 'least…

2 weeks ago

The Simple, Reliable Way to Back Up Your WordPress Blog: A DIY Script for Peace of Mind

Struggling with WordPress backups? Learn how to set up an automated, custom shell script for…

2 weeks ago

My Journey Through Oracle Database World and Cloud world 2025: A Dive into the Future of Data and AI – And a Fresh Start!

After 18 enriching years in the tech world, I recently took a deliberate break, a…

2 weeks ago

Cleared 1Z0-997 Oracle Cloud Infra. Certified Architect Professional…

Cleared following 3 Oracle Cloud Infrastructure exams in a row in three days. Thanks to…

5 years ago