The first opening of a relocated PDB completes recovery and transfers service from the source to the destination. Verify the result with administrative state, a fresh application connection, the committed data, the request outcomes, and recovery readiness.
Oracle DBA Lesson 51 Part 2 — Verify the Relocation Handover
Part 1 covered the online copy and the waiting target. This part follows one change committed after the bulk copy, checks it through a fresh destination connection, and uses a second marker for new writes on the target.
These checks are for ordinary PDBs in compatible single-instance CDBs on Oracle Database 19c. The source uses local undo and is still open read/write. Both CDBs are in ARCHIVELOG mode, and the required redo is available. CREATE ... RELOCATE has completed. The target is still MOUNTED with status RELOCATING. Compatibility, privileges, file naming, capacity, keys, and service routing are already checked. RAC, application containers, Data Guard, and cross-version or encryption migrations need their own supported procedures.
Commit a late source marker
Create this table in APP_USER on the source PDB before the bulk copy starts. If that name is already in use, inspect the object and choose a distinct one.
CREATE TABLE cutover_marker (
marker_id NUMBER PRIMARY KEY,
marker_text VARCHAR2(40)
);
After CREATE ... RELOCATE finishes, while the source is still serving and before the target's first OPEN, insert a known source row and commit it:
INSERT INTO cutover_marker (marker_id, marker_text)
VALUES (731, 'READY_TO_MOVE');
COMMIT;
Read the marker from another source session and record its identity, the row, and that the commit completed. Use an unused marker ID. A duplicate key is a finding to investigate. Keep the table.
The normal synchronous commit is WAIT, IMMEDIATE. Inspect any nondefault commit setting. A successful commit makes the change permanent and visible to later statements in other sessions. This marker is later than the bulk-copy point, so reading it at the destination checks the final catch-up. It is one diagnostic row. It does not prove every row or every application behavior. See COMMIT.
Open the waiting target
Drain new application work, let current transactions finish, and record requests still in progress. Apply the connection-pool, service, and retry procedure already tested for this move. Keep the required recovery information and the tested recovery path.
In the destination CDB root, confirm the container and the unique database identity, then read the target PDB. APP_PDB is that PDB:
SHOW CON_NAME
SELECT db_unique_name FROM v$database;
SELECT name, open_mode, restricted
FROM v$pdbs
WHERE name = 'APP_PDB';
SELECT pdb_name, status
FROM dba_pdbs
WHERE pdb_name = 'APP_PDB';
Before the first opening, the waiting target is MOUNTED and RELOCATING. Compare DB_UNIQUE_NAME with the recorded target. Keep the findings, and resolve a failed prerequisite before opening the PDB.
The consequential statement is:
ALTER PLUGGABLE DATABASE app_pdb OPEN READ WRITE;
The target sets an end recovery marker and applies the required redo and undo. Oracle starts draining source sessions. Persistent active sessions can be terminated. The source closes, and the destination opens read/write. An existing connection is not carried to the other database as the same socket. Clients and continuity mechanisms open the connections their configuration requires at the destination.
Run the two state queries again. A successful destination reports:
| NAME | OPEN_MODE | RESTRICTED |
|---|---|---|
APP_PDB | READ WRITE | NO |
| PDB_NAME | STATUS |
|---|---|
APP_PDB | NORMAL |
V$PDBS describes the current instance's open mode. DBA_PDBS.STATUS describes lifecycle status. RESTRICTED = NO is the ordinary application-access condition. These rows are administrative conditions. Continue with the application checks.
If the open fails, keep the exact error and inspect both CDBs, the lifecycle and open state, and the alert logs before the documented next action. Repeating creation, opening the old and new copies for writes, or applying the unplug/plug DROP ... KEEP DATAFILES sequence skips that evidence. See Relocating a PDB, ALTER PLUGGABLE DATABASE, V$PDBS, and DBA_PDBS.
Check the destination session
Connect through the application's target service. APP_DEST is the Oracle Net alias for that service, and APP_USER is the application schema. SQL*Plus prompts for the password. The application account needs no catalog access to read the SYS_CONTEXT('USERENV', ...) attributes below:
sqlplus APP_USER@APP_DEST
In that fresh session:
SELECT SYS_CONTEXT('USERENV','DB_UNIQUE_NAME') AS db_unique_name,
SYS_CONTEXT('USERENV','CON_NAME') AS con_name,
SYS_CONTEXT('USERENV','SERVICE_NAME') AS service_name
FROM dual;
CDB_TARGET is the destination DB_UNIQUE_NAME, and APP_SERVICE is the application service on the target. The expected row for this example is:
| DB_UNIQUE_NAME | CON_NAME | SERVICE_NAME |
|---|---|---|
CDB_TARGET | APP_PDB | APP_SERVICE |
Compare the returned values with the recorded target. A service name can include a domain, so compare the configured name with the recorded service. CON_NAME is the current container. SERVICE_NAME is the service this session uses.
Different CDBs can share DB_NAME. DB_UNIQUE_NAME distinguishes them, and this SYS_CONTEXT attribute reports it from the same application connection. A successful login, a familiar PDB name, the same host alias, or an unchanged connection string leaves the destination unidentified.
This check uses an explicitly tested destination service. Forwarding depends on listener registration, the relocation availability setting, and the network and client configuration. For isolated listener networks, the guide describes AVAILABILITY MAX and temporary source forwarding metadata. Test the direct target path and any path the application will keep, including whether an old alias forwards in that configuration. See SYS_CONTEXT and DB_UNIQUE_NAME.
Read the late source marker
Through the same fresh connection whose identity was checked:
SELECT marker_id, marker_text
FROM cutover_marker
WHERE marker_id = 731;
The expected row is:
| MARKER_ID | MARKER_TEXT |
|---|---|
731 | READY_TO_MOVE |
That row ties the destination identity to a known source commit made after the copy. A missing or unexpected row calls for a check of the schema, the commit, the connection identity, and the relocation state. A different session, or a stale application cache, does not show that catch-up succeeded.
Run representative application queries and compare them with a recorded baseline. Include the objects, grants, dependencies, jobs, and service behavior the workload uses. Choose those checks from the application. One marker, or one count, is not a complete validation.
Test a new target commit
Through the verified destination application session:
INSERT INTO cutover_marker (marker_id, marker_text)
VALUES (732, 'AFTER_MOVE');
COMMIT;
Open another fresh application session, check its identity, and query the new row:
SELECT marker_id, marker_text
FROM cutover_marker
WHERE marker_id = 732;
The expected row is:
| MARKER_ID | MARKER_TEXT |
|---|---|
732 | AFTER_MOVE |
The second session shows that the new target write committed and can be read independently. Record representative application transactions the same way. After the destination accepts changes, a return plan has to preserve or reconcile them through a supported recovery or reverse-migration procedure. The earlier source cannot simply be reopened as if it already held those new writes.
Reconcile requests and measure interruption
| Request outcome | Useful evidence or action |
|---|---|
| Completed with a recorded result | Compare the actual business result with the expected transaction. |
| Failed with a known error | Determine what completed before applying the application's retry procedure. |
| Outcome unknown after a disconnect or lost commit response | Check the transaction's durable business identifier before resubmitting it. |
A commit can become durable before the client receives the acknowledgment. A lost response leaves the outcome unknown. Reconcile the payment or order identifier, and follow the application's tested duplicate-prevention and retry design. One SQL example does not define a general transaction-retry mechanism. See COMMIT.
Exercise the connection pool and the clients with a representative workload. Record connection failures, failed or delayed requests, retry outcomes, and the first verified response from the destination. Define the application's unavailable or delayed threshold, measure the end-to-end interruption, and keep bulk-copy time separate. Application Continuity and forwarding each have configuration and client prerequisites. There is no universal uninterrupted transaction or zero-outage result.
Confirm recovery readiness
Back up the relocated PDB as the relocation guide requires. Review the backup result, the usable pieces, the required redo, keystore and key availability where they apply, retention, and the documented restore and recovery procedure. Backup validation can check that files are readable and look for corruption. An actual restore and recovery answers the broader operational questions. See backing up a PDB and validating backups.
Relocation owns source removal and forwarding metadata. In the guide's isolated-network AVAILABILITY MAX case, a source tombstone protects the PDB name and forwarding until client updates are complete. After connections go directly to the target and that remaining role is finished, apply the documented cleanup for that stage. One successful login is not a reason to delete the tombstone, the database link, keys, logs, or recovery resources. See Relocating a PDB.
Recap
Commit a known source change after the bulk copy and before the first target open. ALTER PLUGGABLE DATABASE ... OPEN READ WRITE finishes recovery, drains the source, and opens the destination read/write and unrestricted, with lifecycle status NORMAL.
A fresh application session should report the intended DB_UNIQUE_NAME, CON_NAME, and SERVICE_NAME, then read the late source marker. A second fresh session should read a new commit made on the target. Reconcile any request whose commit response was lost, measure the application's interruption separately from the copy, and keep a usable backup and recovery path. Apply source forwarding cleanup at the stage the relocation guide describes.
No comments:
Post a Comment