Enhance Skills Daily

October 03, 2026  ·   · 

Oracle DBA Lesson 50 Part 1 — Preserve a PDB for Transfer

A pluggable database can be unplugged from one container database and plugged into a compatible container database. The source must be closed, and its descriptor, physical files, and required encryption resources must be preserved together.

Oracle DBA Lesson 50 Part 1 — Preserve a PDB for Transfer

This part explains source preparation and preservation. Part 2 checks destination compatibility. Part 3 covers plugging in, opening, and validating the destination.

Close, unplug, and drop

These operations change different things.

Operation Source registration Physical files Practical consequence
CLOSE IMMEDIATE Remains. An ordinary existing PDB has STATUS = NORMAL. Remain on disk. Users are disconnected and uncommitted work is rolled back. The PDB is closed, with OPEN_MODE = MOUNTED.
UNPLUG INTO Remains, with STATUS = UNPLUGGED. Remain. Oracle marks the PDB unplugged in its data files. Creates the XML descriptor or a compressed .pdb archive. Ordinary reopening is no longer supported.
DROP ... KEEP DATAFILES Removed from the source CDB. Permanent data files are retained. The tempfile is deleted. Separate, irreversible catalog removal. The retained permanent files can support the plug procedure.

V$PDBS.OPEN_MODE describes whether the PDB is mounted or open. DBA_PDBS.STATUS describes its catalog lifecycle. A mounted PDB can have NORMAL status after closing and UNPLUGGED status after unplugging. See DBA_PDBS and V$PDBS.

Close the source PDB

Run the sequence from the source CDB$ROOT. The SQL reference requires AS SYSDBA or AS SYSOPER for unplugging, with the privilege available in the root and in the PDB as applicable. The PDB must have been opened at least once, and it must be closed before unplugging. On RAC, close the PDB on every instance. Application containers, snapshot copies, and Data Guard configurations follow their own documented procedures.

CLOSE IMMEDIATE disconnects users and rolls back uncommitted changes. The outage starts here. A large rollback can take time. Before unplugging, an ordinary closed PDB can still be opened with the applicable opening procedure. See administering PDBs with SQL*Plus.

-- Source CDB$ROOT
SHOW CON_NAME

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

ALTER PLUGGABLE DATABASE app_pdb CLOSE IMMEDIATE;

Check the state:

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

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

After an ordinary close of an existing PDB:

NAMEOPEN_MODE
APP_PDBMOUNTED
PDB_NAMESTATUS
APP_PDBNORMAL

Choose one unplug output

The directory in these statements, /transfer, is on the database server, not on the SQL client. It must exist, have space, and allow the Oracle server process to write the output. Where TDE is configured, use the documented key and wallet procedure for that mode before unplugging.

XML descriptor plus separately preserved files

ALTER PLUGGABLE DATABASE app_pdb
  UNPLUG INTO '/transfer/app_pdb.xml';

Oracle writes database metadata and file-location information into the XML descriptor. Table and index contents remain in the permanent data files on disk. Transfer the descriptor together with those files.

Unplug also updates the data files to record the unplugged state. Preserve the completed post-unplug file set together with its matching descriptor. A pre-unplug cold copy is a different file set from the one the new descriptor describes. Keep every required permanent file, with the database identity, inventory, and paths that belong to this PDB. Destination file-location changes use the documented plug syntax and storage configuration. Part 3 covers that mapping. See removing a PDB.

Compressed .pdb archive

As an alternative to XML output:

ALTER PLUGGABLE DATABASE app_pdb
  UNPLUG INTO '/transfer/app_pdb.pdb';

The .pdb output packages an XML descriptor and the PDB files into one compressed archive. Its XML uses relative paths. Plugging the archive in extracts those contents, so the destination needs space for the extraction. See plugging in a PDB.

Choose one output. The two unplug statements are alternatives for a single unplug. An already unplugged PDB is not unplugged a second time with the other form.

Compression does not establish confidentiality. Protect the package, the XML, the physical files, transport secrets, and access to them.

Encrypted data and wallets

For TDE, united mode and isolated mode use different keystore handling. In the documented united-mode unplug procedure, ENCRYPT USING protects the exported PDB encryption keys with a transport secret. The root wallet must be open, and the additional key-management privilege requirements apply. Isolated-mode wallet handling differs. An XML-based transfer can require the associated wallet to be carried separately. The .pdb procedure can package the associated wallet. Follow the procedure for the configured mode and release, including destination key import or access and protected handling of the transport secret. See ALTER PLUGGABLE DATABASE.

A descriptor, an archive, or copied data files alone do not provide access to encrypted data at the destination. The keys and wallet procedure for the configured mode still have to be in place.

Check the unplugged source entry

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

After a successful unplug:

PDB_NAMESTATUS
APP_PDBUNPLUGGED

The catalog row remains. Unplug sets its status to UNPLUGGED. V$PDBS still reports MOUNTED for this closed PDB. UNPLUGGED means the unplug operation completed. The PDB is not open, and destination compatibility is a separate check.

An unplugged PDB cannot simply be reopened. The supported next source operation is dropping it. Returning the PDB to service uses the planned replug or recovery procedure. Retain the recovery resources before this sequence starts.

Remove the source registration

Drop the unplugged source before plugging it into the same CDB or into another CDB. Preserve and verify the transfer set, and review the destination, then remove the source registration:

-- Source CDB$ROOT; verify the exact source and PDB identity first.
DROP PLUGGABLE DATABASE app_pdb KEEP DATAFILES;

KEEP DATAFILES retains the permanent data files, deletes the PDB tempfile, and removes the source catalog references. The drop cannot be rolled back. The plug procedure has to provide temporary-file handling.

INCLUDING DATAFILES deletes permanent files. That is a different operation from this preservation step. Keep a post-unplug source copy, with the backups, logs, and encryption resources the recovery procedure needs, until target validation is complete. Dropping the catalog entry leaves backups and archived redo logs in place. See DROP PLUGGABLE DATABASE.

Preservation and handoff checks

CheckWhat to establish
Identity and inventory The descriptor and the preserved post-unplug file set belong to the intended PDB, and every required file is present.
Transfer integrity Source and destination checksums match for the preserved artifacts. A checksum detects file change. It does not establish plug compatibility or database recoverability.
Access and capacity The destination database process can read the transfer set and has capacity for extraction, copies, and temporary files.
Encryption Required keys and wallets, destination access, and protected transport-secret handling are available for the actual TDE mode.
Recovery The tested replug or restore path, backups, logs, and encryption resources are retained. Define who can restore service and how.
Destination compatibility Run the documented compatibility procedure and inspect violations before target creation. Covered in Part 2.
Target validation After plugging in, verify open state, violations, file placement, application data, integrations, and recovery readiness. Covered in Part 3.

Application services may need separate removal or reconfiguration. Unplugging or dropping the PDB does not remove or reconfigure those services. Keep the recovery copy until target validation succeeds. See administering PDBs with SQL*Plus.

Recap

Close the source with CLOSE IMMEDIATE. An ordinary existing PDB then shows OPEN_MODE = MOUNTED and STATUS = NORMAL. Unplug into one output: an XML descriptor plus the completed post-unplug data files, or one compressed .pdb archive. The catalog row remains with STATUS = UNPLUGGED, and ordinary reopening is no longer supported. Preserve that matching descriptor or archive, the post-unplug files, and any required encryption resources. DROP PLUGGABLE DATABASE ... KEEP DATAFILES then removes the source registration, keeps the permanent data files, and deletes the tempfile. Destination compatibility and target validation follow in the next parts.

Quiz

1. After closing an ordinary existing PDB, which combination is expected?

2. What does XML-based unplug output contain?

3. Does unplugging remove the source catalog row?

4. What does DROP ... KEEP DATAFILES do?

5. Which transfer is sufficient to proceed to destination checks?

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