Enhance Skills Daily

October 03, 2026

Oracle DBA Lesson 32 Part 2 — Restore a CDB and Recover Committed Work

Complete recovery aims to retain all committed transactions. This part follows a whole container database (CDB) using its current control file and all required redo. A later row can return even though it was committed after the selected backup.

Oracle DBA Lesson 32 Part 2 — Restore a CDB and Recover Committed Work

How the two steps work

Restore reconstructs physical data files on disk from saved backups. Their contents belong to an older state. The backup source remains available. Recover applies the changes required to advance those files. Retained archived redo and surviving online redo, together with suitable incremental backups where selected, support that path. Redo records describe changes. They are not replacement data files.

One row is committed before the backup and another is committed afterward. Restoring the older contents supplies the first row. Applying the required later changes brings the files forward so that both committed rows can be verified after opening. An online backup can require redo even to make the restored files consistent. Its completion time is not an exact universal checkpoint.

Connected to the root, the whole-CDB operation includes the root, the seed, and the pluggable database data files. The CDB stays mounted during the operation. RESTORE DATABASE does not restore the current control file or replace surviving online redo logs. Control-file restoration is a separate operation. Temp files are recreated where needed rather than backed up and recovered like permanent data files. See complete database and whole-CDB recovery and RMAN database-object scope.

Conditions for complete recovery

Use ARCHIVELOG mode on a same-identity full recovery copy. This is not a new-identity clone.

Retain the current control file, the reviewed startup settings, every required backup piece and incremental, the archived redo, and the surviving online redo. Ensure the configured channels can read the media. Supply encryption access if it applies. Use a root common account with SYSDBA or SYSBACKUP for RMAN. The SQL startup and open examples require SYSDBA. The application account owns its marker table. Opening a CDB affects all of its application services.

Committed before and after the backup

Connect as the application owner through its verified service:

CREATE TABLE recovery_marker (
  marker_id NUMBER PRIMARY KEY,
  marker_text VARCHAR2(80)
);
INSERT INTO recovery_marker VALUES (1, 'committed before backup');
COMMIT;

Take the planned physical backup while retaining the current control file and the required redo. Record the pieces and the backup and checkpoint coverage. Avoid taking a newer data-file backup that silently changes this comparison. After that backup, as the application owner:

INSERT INTO recovery_marker VALUES (2, 'committed after backup');
COMMIT;
SELECT marker_id, marker_text
FROM recovery_marker ORDER BY marker_id;

Record both committed rows before the recovery begins. Preserve the full copy and the redo it needs. An intact copy deliberately uses FORCE to ensure actual reconstruction without deleting a file.

Mount, restore, recover, and open

From SQL*Plus, connected to the CDB root as SYSDBA:

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;

The instance reads the current control-file inventory while application access stays closed. For a failed instance, use a startup or shutdown decision suited to its actual state. This sequence assumes an intact copy.

From RMAN, connected to that same root with the required recovery privilege:

RESTORE DATABASE FORCE;
RECOVER DATABASE;

FORCE overrides restartable restore. On an intact copy, an ordinary restore can skip files whose headers match the control-file records. Here FORCE replaces those target file contents from the selected backups. It is not a default instruction for every incident. It does not fix corruption in a backup, provide missing redo, or select an earlier target. Retain the restore log and verify the actual reconstruction, the selected piece handles, and the target file names. A skipped operation is not evidence of a completed restore. See RESTORE.

Recovery advances the restored files using the required changes. Preserve its complete result and investigate errors. If a log is missing, or media recovery remains unresolved, stop. Do not silently change the desired recovery point, discard errors, or try an opening option to conceal the gap. See RECOVER.

Only after successful complete recovery with the current control file retained, return to SQL*Plus at the same root:

ALTER DATABASE OPEN;
SELECT name, open_mode FROM v$pdbs ORDER BY con_id;

Ordinary OPEN is appropriate for this case. Recovery with a restored backup control file, or intentional point-in-time recovery, has different opening requirements, covered in later parts. RESETLOGS is not a generic repair for missing redo. See V$PDBS.

If the required APPDB is still MOUNTED and its expected mode is READ WRITE:

ALTER PLUGGABLE DATABASE APPDB OPEN;

Check before issuing this statement. A saved PDB state can reopen it automatically. Do not repeat OPEN against an already open PDB. Resolve any opening error before declaring availability. Inspect all required PDB states, not only the root. The seed normally stays READ ONLY. See ALTER PLUGGABLE DATABASE.

Verify the result and elapsed time

Confirm that ISOLATED_APP_SERVICE routes to the intended CDB and application PDB. Reconnect as APP_USER through that verified service. Confirm the session context:

SELECT sys_context('USERENV','DB_NAME') AS database_name,
       sys_context('USERENV','CON_NAME') AS container_name,
       sys_context('USERENV','SERVICE_NAME') AS service_name
FROM dual;

SELECT marker_id, marker_text
FROM recovery_marker ORDER BY marker_id;

The second query should show both exact committed markers. Compare them with the previously recorded baseline, and check the expected database and container before interpreting the result. Then exercise the required application operation through the service. Merely opening the root, seeing a process start, or reading unrelated rows is insufficient evidence. See SYS_CONTEXT.

Time the full restore, recovery, open, and application verification interval, and compare it with the recovery-time objective (RTO).

Quiz

1. Why can the post-backup committed row reappear?

2. Why is FORCE used in this intact disposable rehearsal?

3. Which opening command fits successful complete recovery with the current control file retained?

4. The CDB has opened. What should happen before another PDB OPEN statement?

5. Which evidence demonstrates this drill's application criterion?

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