PDB relocation moves a pluggable database to another container database while much of the copy runs and the source continues serving application work. The important operational decision is the first target OPEN: that step performs final recovery and the handover from source to destination.
Oracle DBA Lesson 51 Part 1 — Prepare a Live PDB Move
This part explains preparation, copy behavior, and the waiting target. Part 2 covers the planned opening and fresh-client validation in detail.
What the online move requires
The online case uses ordinary PDBs in two compatible single-instance CDBs on Oracle Database 19c.
- The source CDB is in local undo mode, and the source PDB is open READ WRITE.
- Both CDBs are in ARCHIVELOG mode, with the required redo available throughout the operation. That selects the documented online case. A non-ARCHIVELOG target follows a different procedure.
- The destination CDB is open read/write, with enough file and recovery-log capacity, a suitable Oracle Managed Files destination, and an available target PDB name.
- Release and release update, options, endianness, and the applicable character-set requirements are compatible. When the destination character set is
AL32UTF8, Oracle documents an exception to its usual character-set compatibility prerequisite. Check the feature and release restrictions that apply to the move. - When TDE is involved, the required encryption keys and the documented keystore procedure are part of the move. An unencrypted relocation is not a complete encryption migration.
- Backup and restore coverage, application drain, retry, and reconnect behavior, listener and service routing, stop criteria, and the maintenance window are part of the plan.
RAC, application containers, Data Guard, upgrades, and cross-endian migrations need their own supported procedures. See Relocating a PDB.
Create through a source-root database link
Run the creation in the destination CDB$ROOT as a common user with the commonly granted CREATE PLUGGABLE DATABASE privilege. Queries and the later open require their own privileges.
The existing private MOVE_SOURCE database link is created in the destination and connects back to the source CDB root. For an ordinary PDB, that connection uses a common user with CREATE PLUGGABLE DATABASE or SYSOPER. Confirm the source identity, that the link can connect, and the privilege scope. The link identifies the source. Application clients continue to use their application service. A routine application account is not the user for this link.
The relocation guide also requires saving the source PDB service and open state. Its source-root statement is:
ALTER PLUGGABLE DATABASE ALL SAVE STATE INSTANCES=ALL;
This statement affects saved state for all PDBs in its scope. Confirm the services and open states the move should carry, rather than treating the statement alone as evidence that preparation is complete. See ALTER PLUGGABLE DATABASE.
Keep the three directions clear
| Relationship | Direction | Purpose |
|---|---|---|
| Initiating database-link connection | Destination root → source root | Lets the destination identify and read the source for relocation. |
| Copied data and required recovery information | Source → destination | Builds the destination's files and a consistent copied state. |
| Application connections during bulk copy | Application → source PDB | Keeps existing work at the source while the copy proceeds. |
The database-link arrow is a connection relationship. It does not mean source files move backward to the source, or that application clients should connect through that administrative link.
Start relocation in the destination root
Confirm the actual root and CDB identity first:
SHOW CON_NAME
SELECT db_unique_name FROM v$database;
The next statement assumes the MOVE_SOURCE link and a configured Oracle Managed Files destination. APP_PDB is available as a target name and identifies the intended source through the link:
CREATE PLUGGABLE DATABASE app_pdb
FROM app_pdb@move_source RELOCATE;
CREATE PLUGGABLE DATABASE app_pdbnames the target PDB.FROM app_pdb@move_sourceidentifies the source PDB through the database link.RELOCATEselects the relocation workflow, which transfers the PDB to the destination and removes the original source PDB.
With no explicit file conversion, Oracle first attempts Oracle Managed Files naming, then the PDB_FILE_NAME_CONVERT alternative. A valid naming configuration is required. This statement assumes Oracle Managed Files, so inspect that destination and its capacity before issuing it. Use a supported explicit naming procedure when the configuration needs it, including temporary files.
The default availability is NORMAL. Common or cross-registered listener networks can route services according to their configured behavior. AVAILABILITY MAX adds forwarding behavior for applicable network arrangements. It is not a universal transaction-preservation switch. The baseline uses an explicitly verified destination application service. Select forwarding only after checking the actual listener and client requirements. See CREATE PLUGGABLE DATABASE.
What happens during the online copy
The source continues processing application work while Oracle performs the online block-level copy. Source data files remain in use, and separate destination files are built. Required redo and undo support a transactionally consistent copied point.
The source can change after that copied point. The first target opening establishes an end point and applies the remaining recovery information. Treat the mounted target as a relocation in progress, rather than an independently writable application database or a continuously synchronized recovery replica.
Bulk-copy duration depends on the data volume, the workload, the transfer path, and storage performance. Where applicable, the guide identifies file and redo copy operations in V$SESSION_LONGOPS:
SELECT opname, sofar, totalwork, units,
elapsed_seconds, time_remaining
FROM v$session_longops
WHERE opname IN ('kpdbfCopyTaskCbk', 'kcrfremnoc');
Inspect the session, the operation, and the time context. A row can refer to an earlier operation, and TIME_REMAINING is an estimate. An absent row by itself cannot establish completion. See V$SESSION_LONGOPS.
Inspect the waiting destination
After a successful CREATE ... RELOCATE, query the destination root:
SELECT name, open_mode
FROM v$pdbs
WHERE name = 'APP_PDB';
SELECT pdb_name, status
FROM dba_pdbs
WHERE pdb_name = 'APP_PDB';
The expected state before the first opening is:
| NAME / PDB_NAME | OPEN_MODE | STATUS |
|---|---|---|
APP_PDB | MOUNTED | RELOCATING |
V$PDBS.OPEN_MODE describes the current instance's open mode. MOUNTED means the target is closed to ordinary application work. DBA_PDBS.STATUS describes the PDB lifecycle. RELOCATING means the relocation is still in progress. Inspect both properties, and the source's availability, before the next action.
If creation reports an error, retain the exact error and inspect both CDBs, the target catalog state, and the alert logs. Oracle documents that a failed creation can leave a PDB UNUSABLE. Choose recovery or cleanup from the actual stage and the documented requirements. Repeating CREATE without that inspection, dropping a target that was only guessed, or treating a stopped script as proof that the source remained available skips the evidence. See DBA_PDBS and V$PDBS.
What the first target OPEN changes
The consequential statement in the destination root is:
-- Planned cutover, after the required checks and application preparation:
ALTER PLUGGABLE DATABASE app_pdb OPEN READ WRITE;
The guide describes this handover:
- The target establishes the end marker and applies the redo and undo needed to complete recovery to that point.
- Oracle initiates draining of source sessions. Remaining active sessions can be terminated according to the workflow and the draining behavior.
- The source service is transferred as the source closes and the target opens read/write. The source and the destination are never simultaneously open as two writable copies of this relocated PDB.
- After a successful read/write opening, the target's catalog status becomes
NORMAL.
The listener registration and forwarding sequence depends on the network arrangement and the availability setting. Application Continuity, connection pools, request boundaries, and retry behavior each have their own prerequisites. Rehearse the actual clients. An active transaction is not assumed to survive, and an unchanged connection string does not prove that the service transferred.
Source removal and forwarding metadata follow the relocation workflow. Do not add the manual source DROP ... KEEP DATAFILES sequence from unplug and plug. Part 2 covers the planned opening and the evidence that fresh clients reach the destination. See Relocating a PDB.
Decide before the first open
Before the first target open, confirm each of these conditions:
- Source and target CDB and exact PDB identity, the link destination, and the current states.
- Required redo available, and target files, space, and creation findings reviewed.
- Application drain, pool reconnection, service routing, and retry rehearsal.
- Defined stop criteria and a recovery path before and after cutover.
- Required keys, backup resources, and restore rehearsal available.
A pre-cutover failure requires inspection of both sides and preservation of the evidence before anything is removed. After new writes reach the destination, a return plan must preserve or reconcile those changes using the supported recovery or reverse-migration procedure. Reopening old files alone can lose new work or create conflicting writable locations.
Measure the interruption the application experiences
Record bulk-copy elapsed time separately from end-to-end application interruption. Much of the copy can run while the source is still serving. Final recovery, draining, listener and service changes, pool behavior, and client reconnection shape the interruption the application experiences.
Use a representative workload. Record request start and completion, connection failures, retry results, and the first verified destination response. Define what counts as unavailable for that application, including failed or excessively delayed requests. Use those measurements to plan the maintenance window. This operation has no universal outage duration.
Recap
Relocation copies a PDB to another CDB while the source keeps serving. The database link runs from the destination root to the source root. Copied data and recovery information move toward the destination, and application sessions stay on the source during the bulk copy.
CREATE PLUGGABLE DATABASE ... RELOCATE leaves the target MOUNTED with status RELOCATING. The first OPEN READ WRITE finishes recovery, drains the source, and opens the destination. The two sides are never writable copies at the same time. After that open succeeds, catalog status becomes NORMAL.
Measure the application's interruption separately from the copy. Once the destination has accepted new writes, a return plan has to preserve or reconcile those changes.
No comments:
Post a Comment