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.
Recent Comments