For a compatible Oracle 19c non-CDB, descriptor-based adoption separates source preparation, root-level file creation, and dictionary conversion inside the new PDB. Each operation prepares the state the next one needs.
Oracle DBA Lesson 53 Part 2 — Adopt a Non-CDB as a PDB
Confirm the source and the destination
This sequence adopts an existing 19c non-CDB into a compatible 19c target CDB as an ordinary PDB named APP_PDB. It uses COPY, with Oracle managed files (OMF) already configured in the destination. An earlier-release source needs a separately supported upgrade path. Choosing the method and collecting the inventory are covered in Part 1.
See adopting a non-CDB as a PDB.
- Confirm the source identity, the exact release and RU, and the installed components. Resolve platform, endianness, character set, patch level, time zone, encryption keys, and the other compatibility requirements that apply.
- Keep a tested source backup and recovery copy independent of the target files. Record source object counts, important business totals, and the application acceptance tests before writes stop.
- The destination CDB is open read/write. The name
APP_PDBand the relevant service names are available. Destination capacity covers the separate copy. - OMF is configured, and the destination can create the new files. With OMF, the create statement omits destination filename conversion. Without OMF, include the supported destination naming clauses.
- Describe the source and convert the target AS SYSDBA. Creating the PDB in the root also requires the commonly granted creation privilege. The active Oracle home is the target software.
- Destination Oracle processes can read
/transfer/noncdb.xmland every matching source file. That path is a filesystem path on the database server. A client-side SQL directory object does not supply it. - Keep clients and jobs from writing to the source during the outage.
Open the source read only
In SQL*Plus, connect to the source AS SYSDBA:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE OPEN READ ONLY;
SHUTDOWN IMMEDIATE ends sessions, rolls back unfinished transactions, and closes the database consistently. Mount the database, then open it read only so application writes stay stopped while the source is described. Include rollback and shutdown time in the interruption. A consistent shutdown and a read-only open are the preparation. An abort leaves a different state.
Protect the source recovery arrangement independently. COPY later preserves the source file set. It does not itself verify a usable backup or the source recovery procedure.
Generate the descriptor
BEGIN
DBMS_PDB.DESCRIBE(
pdb_descr_file => '/transfer/noncdb.xml');
END;
/
DBMS_PDB.DESCRIBE writes an XML description of the source and the associated file locations. The application rows remain in the data files. The destination needs the descriptor and access to the corresponding files.
The XML identifies source file locations the target can reach. When the files were staged elsewhere, SOURCE_FILE_NAME_CONVERT or SOURCE_FILE_DIRECTORY locates them. Source-location mapping and destination-file naming do different work. Leave the descriptor unchanged and correct the storage plan instead of hand-editing the XML. Check that the directory exists, that permissions allow the read, that the files are complete, and that any required encryption keys are available.
Check compatibility in the target root
Connect to the destination CDB root. Verify the current container, then call the function:
SHOW CON_NAME
SET SERVEROUTPUT ON
BEGIN
IF DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
'/transfer/noncdb.xml', 'APP_PDB') THEN
DBMS_OUTPUT.PUT_LINE('YES');
ELSE
DBMS_OUTPUT.PUT_LINE('NO');
END IF;
END;
/
The function returns a PL/SQL Boolean. The block prints that value as text. The second argument is the intended target PDB name.
| Printed result | Interpretation and next action |
|---|---|
YES | The described source is compatible with this destination. Review the reported findings and proceed when the required issues are addressed. |
NO | Inspect the reported incompatibilities, apply their documented remediation, and repeat the function. |
See DBMS_PDB.
Read outstanding messages in the target root:
SELECT cause, type, status, message, action
FROM pdb_plug_in_violations
WHERE name = 'APP_PDB' AND status = 'PENDING'
ORDER BY time, line;
| Field | What to inspect |
|---|---|
CAUSE | Attribute being checked |
TYPE | ERROR or WARNING |
STATUS | PENDING, RESOLVED, or IGNORE |
MESSAGE | Description of the incompatibility |
ACTION | Recommended corrective action |
Apply the procedure for the actual mismatch. A version or patch difference may require a supported upgrade or a SQL patch. Other findings require their own fixes. Read the findings before another creation attempt. Review warnings as well as errors. Repeat the compatibility check after remediation. These checks establish compatibility. Application acceptance is tested later.
Shut down the source and create the copy
On the source:
SHUTDOWN IMMEDIATE;
From the destination root, after compatibility checking succeeds and the required findings are resolved:
CREATE PLUGGABLE DATABASE app_pdb
USING '/transfer/noncdb.xml'
COPY;
USING supplies the descriptor. COPY creates separate destination files and leaves the original source files in place. With the verified OMF configuration, Oracle generates the target file names. A non-OMF configuration requires its own validated destination file naming. Do not substitute NOCOPY or MOVE while expecting the source file set to remain independent.
The new PDB is mounted after creation. Complete non-CDB dictionary conversion before its normal first opening. Check plug-in messages again. A creation problem can leave an unusable target that needs diagnosis.
The unquoted name app_pdb is stored as APP_PDB.
See CREATE PLUGGABLE DATABASE.
Convert the dictionary in the new PDB
On the target connection established AS SYSDBA:
ALTER SESSION SET CONTAINER=app_pdb;
SHOW CON_NAME
Expected container confirmation:
| CON_NAME |
|---|
APP_PDB |
ALTER SESSION changes the current container of this session. It does not move rows or files. Confirm the new PDB before running the conversion. Run the conversion script in APP_PDB. It does not belong in CDB$ROOT, on the source database, or on an ordinary PDB clone.
Capture the conversion log, then run the Oracle-supplied script from the active target Oracle home:
SPOOL /transfer/app_pdb_conversion.log
@?/rdbms/admin/noncdb_to_pdb.sql
SPOOL OFF
In SQL*Plus, ? identifies the active Oracle home and @ runs the script. The script converts the non-CDB dictionary to the PDB dictionary structure. It performs its own opening, changes, and closing. Inspect completion and the reported errors before the normal opening. The last printed line alone is not an acceptance test.
This script is specific to non-CDB conversion. An ordinary PDB clone already has PDB dictionary structure. Dictionary changes and DDL persist beyond an ordinary SQL ROLLBACK. Recovery uses the source backup plan prepared before the copy.
Open, inspect, and back up
Inside the converted PDB, after the script completes successfully:
ALTER PLUGGABLE DATABASE OPEN READ WRITE;
Oracle completes integration into the CDB. From the destination root, inspect the state:
ALTER SESSION SET CONTAINER=CDB$ROOT;
SELECT p.name, p.open_mode, p.restricted, d.status
FROM v$pdbs p JOIN dba_pdbs d
ON d.pdb_id = p.con_id
WHERE p.name = 'APP_PDB';
Expected after successful integration:
| NAME | OPEN_MODE | RESTRICTED | STATUS |
|---|---|---|---|
APP_PDB | READ WRITE | NO | NORMAL |
V$PDBS describes the current-instance open mode and restriction. DBA_PDBS records integration status. In RAC, assess the intended instances and services separately. Review the remaining plug-in messages and the alert and conversion logs. Investigate a restricted open or outstanding errors before general client access.
Test through the intended destination application service:
- Confirm the service reaches
APP_PDBand the expected account has the necessary privileges. - Compare the recorded object and key totals and the important business values. Validate content, not only row counts.
- Complete the required application transaction. Check jobs, database links, directory and external paths, and other dependencies.
- Review privileged accounts and application behavior in the destination.
- Back up the new PDB and verify its usable recovery arrangement. Retain the protected source until acceptance and the retention conditions permit release.
If conversion fails, preserve the logs and the target files for diagnosis and follow the recovery procedure prepared for the source. A blind rerun, or deleting those files immediately, removes the evidence the diagnosis needs. After clients commit transactions that exist only in the target, returning to the old source requires a plan for those new changes, as discussed in Part 1.
Recap
Open the compatible 19c non-CDB read only, write the XML descriptor, and check plug-in compatibility in the target root. Shut the source down, then create APP_PDB with COPY so the target receives separate files and the source files stay in place. Switch into the new PDB, run noncdb_to_pdb.sql, and open it read/write after that conversion. Confirm an unrestricted READ WRITE PDB with status NORMAL, validate the application, and back up the new PDB. The conversion script is specific to a non-CDB source, and SQL ROLLBACK does not undo the dictionary changes.
No comments:
Post a Comment