Enhance Skills Daily

October 03, 2026  ·   · 

Oracle DBA Lesson 50 Part 3 — Plug and Validate the Destination

After the compatibility review, create the destination pluggable database with separate files, complete its first read/write opening, and verify the application path and recovery arrangements.

Oracle DBA Lesson 50 Part 3 — Plug and Validate the Destination

Part 1 preserved the source. Part 2 assessed the destination. This part puts the destination into service.

Remove the source registration before the plug

Oracle requires dropping an unplugged PDB before plugging it into the same CDB or into another CDB. The drop runs in the source root. It is separate from creating the target.

Confirm the source container and database, then drop the unplugged PDB:

-- In the confirmed source CDB$ROOT, after unplugging:
SHOW CON_NAME
SELECT db_unique_name FROM v$database;

DROP PLUGGABLE DATABASE app_pdb KEEP DATAFILES;

KEEP DATAFILES preserves the permanent data files. Oracle deletes the associated tempfile. Keep the matching completed post-unplug descriptor, the protected file copies, and the required keys and recovery resources. Removing the catalog entry is not a reason to delete that preserved source set.

Source registration is removed before the target plug. Protected source resources stay in place through destination validation and the required retention period. A retained source set supports a planned fallback. It is not a running replica, and it does not guarantee that every later change can be recovered into it.

See DROP PLUGGABLE DATABASE and ALTER PLUGGABLE DATABASE.

Create separate destination files with COPY

The destination CDB must be open read/write, and the intended PDB name must be available. Creating an ordinary PDB in the root requires a commonly granted CREATE PLUGGABLE DATABASE privilege. RAC, Data Guard, application containers, release upgrades, cross-endian migration, and TDE can require additional procedures.

In the destination root, confirm the container and database. This statement expects Oracle Managed Files to be configured for a suitable destination. Confirm that destination and its capacity. The descriptor's source paths must be readable by the destination database process.

-- In the confirmed destination CDB$ROOT:
SHOW CON_NAME
SELECT db_unique_name FROM v$database;

CREATE PLUGGABLE DATABASE app_pdb
  USING '/transfer/app_pdb.xml' COPY;

USING supplies the completed PDB description. COPY reads the referenced source files and creates separate destination files. The destination uses those new files. The preserved originals remain available.

Oracle Managed Files generates destination names when file-name conversion is omitted. If OMF is not configured, use a supported FILE_NAME_CONVERT or PDB_FILE_NAME_CONVERT setting. Without a valid naming method, creation fails.

When the files have moved since the descriptor was written, correct source lookup with a different CREATE statement. It replaces the statement above. It is not a second command after a successful creation.

-- Alternative CREATE, not an additional command after successful creation.
-- Assumes destination OMF and these verified replaceable source prefixes:
CREATE PLUGGABLE DATABASE app_pdb
  USING '/transfer/app_pdb.xml'
  SOURCE_FILE_NAME_CONVERT = ('/old/app_pdb/', '/transfer/app_pdb/')
  COPY;

SOURCE_FILE_NAME_CONVERT maps paths recorded in the descriptor to the actual source files. It does not choose the new destination file names. FILE_NAME_CONVERT chooses destination names. The two clauses do different work. SOURCE_FILE_DIRECTORY is another documented source-location option, with its own restrictions. For existing OMF names, use the documented OMF procedure rather than inventing conversion patterns.

Plan temporary files as well. Use TEMPFILE REUSE only when you intend to reuse the verified tempfile at the required location. The clause can format that file. Do not add it to bypass an unexplained file-exists error. For an encrypted PDB, follow the united or isolated keystore procedure for that mode and retain the required keys.

COPY, NOCOPY, and MOVE

ClauseEffectConsequence
COPY Creates new destination files from the source files. This is the default for the relevant plug-in operation. Retains the original file set while the destination uses its own copies.
NOCOPY Uses files at their existing locations. Those files become the target's working files; it does not create a protected source copy.
MOVE Relocates the source files to the target location. Where a move is not supported across mount points, Oracle can copy and remove the originals. The original files no longer remain at that source location.

Choose the clause from the required ownership, space, and recovery conditions. Two active databases must not use the same physical data files. Different path strings do not by themselves mean separate storage, separate failure domains, or a tested recovery path. See CREATE PLUGGABLE DATABASE and plugging in a PDB.

Open read/write to finish integration

After creation, the PDB is mounted and DBA_PDBS.STATUS is NEW. The first opening must be read/write so Oracle can finish integrating the PDB into the CDB.

ALTER PLUGGABLE DATABASE app_pdb OPEN READ WRITE;

After successful integration, the catalog status becomes NORMAL. A first read-only opening cannot complete this integration. Open mode, restricted access, and catalog status are different properties. Successful integration does not by itself show that application service is unrestricted.

Follow a release upgrade or SQL patch procedure at the stage that procedure documents. An ordinary PDB-to-PDB move does not use noncdb_to_pdb.sql. That script belongs to non-CDB conversion. If creation leaves the PDB UNUSABLE, read the creation error and the alert log. Oracle permits only dropping an unusable PDB. Confirm the exact target and protect retained files before that drop. See ALTER PLUGGABLE DATABASE.

Check open mode, catalog status, and files

From the destination root:

SELECT name, open_mode, restricted
FROM v$pdbs
WHERE name = 'APP_PDB';

SELECT pdb_name, status
FROM dba_pdbs
WHERE pdb_name = 'APP_PDB';

After successful integration, and after any required remedy, the queries show this state:

NAME / PDB_NAMEOPEN_MODERESTRICTEDSTATUS
APP_PDBREAD WRITENONORMAL

V$PDBS.RESTRICTED = YES means only users with the RESTRICTED SESSION privilege can connect. The value can be null when it does not apply. DBA_PDBS.STATUS is the catalog lifecycle status. It is not another name for OPEN_MODE.

When the open is restricted, or findings remain, read the unresolved plug-in violations:

SELECT time, type, status, cause, message, action
FROM pdb_plug_in_violations
WHERE name = 'APP_PDB'
  AND status <> 'RESOLVED'
ORDER BY time, line;

Excluding RESOLVED can still return PENDING and IGNORE rows. Read each row with its context and the documented action. Keep the target, the descriptor or name, and the check time with the result. Leave the dictionary rows as Oracle recorded them. Apply the prescribed remedy, check again, and keep any finding that is still unresolved.

In the target PDB, list the data-file paths:

ALTER SESSION SET CONTAINER = app_pdb;
SELECT file_id, tablespace_name, file_name
FROM dba_data_files
ORDER BY file_id;

Compare those paths with the intended destination storage and with the retained source inventory. Check tempfiles separately when they matter. The paths show where the files are registered. They do not prove that the storage is physically separate, and they do not prove that a restore succeeded. See V$PDBS, DBA_PDBS, DBA_DATA_FILES, and PDB_PLUG_IN_VIOLATIONS.

Validate the application through its service

An administrator session in the root does not test the route the application uses. Open a fresh connection from the client and network path the application uses:

sqlplus app_user@APP_SERVICE

Use the intended application service and its supported configuration. A default service does not prove listener registration, network reachability, application routing, or every service requirement. Avoid service-name collisions in the listener's scope.

In that new session, read the container and service:

SELECT SYS_CONTEXT('USERENV', 'CON_NAME') AS container_name,
       SYS_CONTEXT('USERENV', 'SERVICE_NAME') AS service_name
FROM dual;

Compare both values with the intended target. Then compare application data with the baseline recorded before the move. Use the same business keys and values. Equal counts can still hide wrong values, missing keys, or a session in the wrong database.

SELECT COUNT(*) AS order_count FROM orders;

SELECT order_id, status, total_amount
FROM orders
WHERE order_id IN (1001, 1002)
ORDER BY order_id;
ValidationWhat to record
Fresh client connection The session reaches the intended target container and service.
Important rows, keys, and business values They match the relevant baseline.
Required jobs They run with the correct configuration and expected outcomes.
External connections, directories, and integrations They work as intended.
Patch, upgrade, and plug findings The required actions have been reviewed.

Record the outcomes and any unresolved actions before returning users. See SYS_CONTEXT.

Establish destination recovery readiness

Take the planned destination backup. From an RMAN connection to the destination root, one form is:

BACKUP PLUGGABLE DATABASE app_pdb;

The command backs up the named PDB's data files. It is not a complete recovery strategy. Confirm the backup records, that the backup pieces can be read, the required archived redo, root and control-file recovery resources, the retention and deletion policy, and encryption-key availability. Use the documented root backup procedure, including archived redo where that procedure requires it. The PDB command does not by itself protect every resource.

Keep the protected post-unplug source files and their matching descriptor and keys for the retention period in the migration plan. After users write new data at the destination, the retained source is behind those writes. A fallback to that older set needs an explicit plan for the new target changes, for consistency, and for application routing. COPY does not keep the two sets synchronized. Release the source resources only after validation, recovery, and retention conditions are met. See backing up the database.

Recap

Drop the unplugged source with KEEP DATAFILES before the plug, and keep the permanent files, descriptor, and keys. In the destination root, CREATE PLUGGABLE DATABASE ... COPY builds separate destination files when OMF or a supported file-name conversion supplies the new names. The first open is READ WRITE, so a successful integration can set DBA_PDBS.STATUS to NORMAL. Check open mode, restricted access, catalog status, unresolved plug-in violations, and the registered file paths. A fresh application-service connection, a baseline comparison, jobs, integrations, and a destination backup are separate checks. New writes at the target are not in the retained source.

Quiz

1. Why use COPY when the move must retain the original post-unplug source files?

2. When must the source's unplugged PDB catalog entry be dropped?

3. Why must the first target opening be read/write?

4. Which result most directly tests the application's destination connection?

5. Users have written new data at the target. What does that mean for fallback to the retained source set?

No comments:

Post a Comment

Vocabulary Revision 6 — Lessons 21 to 24

Lessons 21–24 · 16 words Watch on YouTube Contents https://www.apps-dba.com/ https://www.youtube.com/@EnhanceSkillsDaily Open ...