| Lesson 8 | Recovering with a Backup Control File |
| Objective | Explain when a backup control file is appropriate and demonstrate restoration, recovery, RESETLOGS, and verification for the selected recovery scope. |
A control file records the database identity, physical file structure, checkpoint and redo information, and RMAN repository records. Restoring a backup control file makes an earlier version of that metadata available. Data file restoration and media recovery recover the application data.
Oracle AI Database 26ai supports recovery with a backup control file through RMAN and user-managed SQL*Plus procedures. After recovery using a restored backup control file, you must open with RESETLOGS. This requirement also applies when recovery preserves all committed changes.
Control-file condition and recovery endpoint are separate decisions. In the example below, recovery is incomplete because the team deliberately stops before an unwanted tablespace drop. The backup control file provides the historical structure used by that chosen recovery plan.
First determine which control files remain usable and what you need to recover. Losing one redundant copy is different from losing every current copy or choosing to reconstruct an earlier database state.
| Situation | Approach |
|---|---|
| A current copy survives | Follow the documented procedure to restore redundancy from the verified surviving current copy with the instance shut down. That loss alone does not require an older control file or RESETLOGS. |
| All current copies are lost | The usual RMAN procedure restores a binary backup control file, mounts it, performs recovery, and opens RESETLOGS. |
| A chosen plan needs historical structure | A suitable older control file can supply that structure. Evaluate the recovery scope before replacing the target's current control file. |
| A trace script is available | Control-file recreation is a separate procedure with its own requirements. A trace script is not a binary backup. |
If only the control files were lost and current data files remain intact, do not automatically restore the data files or accept lost commits. A suitable control-file restore followed by recovery can preserve the current data. Additional physical damage may change the required procedure.
At 2:14 PM on 21-JAN-2025, a DBA in training reports accidentally dropping the STUDENT tablespace about ten minutes earlier. STUDENT contained the CUSTOMERS table. Significant customer updates occurred roughly two hours before the report, and those updates need to be preserved.
The following is the historical operation that caused the incident:
DROP TABLESPACE STUDENT INCLUDING CONTENTS;
Suitable data file backups and a control-file backup are available from the previous night, 20-JAN-2025. Preliminary evidence places the DROP around 14:04:13. The recovery team considers 14:04:00 as a candidate endpoint, subject to verifying that it precedes the harmful change.
These are illustrative dates. Actual recovery requires usable backups, redo, metadata, and encryption material covering the selected endpoint. A correctly formatted timestamp does not establish that an arbitrary historical date is recoverable.
A dropped tablespace is not placed in the recycle bin, and dropping it purges recycle-bin objects belonging to it. Ordinary Flashback Drop cannot undo this tablespace drop. Oracle-managed files can be removed automatically; other files may remain unless AND DATAFILES was specified. Remaining files do not automatically restore dictionary entries.
RMAN tablespace point-in-time recovery can recover dropped tablespaces, including without a recovery catalog, when its prerequisites are met. PDB point-in-time recovery or a suitable auxiliary recovery and export may also be relevant. Evaluate those options before rewinding the whole CDB.
Teaching assumption: The team has evaluated alternatives and selected whole-CDB point-in-time recovery using a verified control-file backup from before the drop. Application owners accept the exclusion of later commits throughout the CDB, including other PDBs. The example does not assume that a tablespace drop damaged the current control file.
The alert log can help locate the operation, but a displayed DDL timestamp is not automatically its exact commit boundary. Correlate it with available audit and application records. Establish that the candidate target precedes the DROP and preserves the earlier customer updates.
RMAN documents UNTIL TIME as a noninclusive limit, with practical granularity determined by timestamps in redo. An explicit TO_DATE format avoids dependence on NLS_DATE_FORMAT but does not specify a time zone. Reconcile clocks before relying on a seconds-level margin. An exact SCN boundary may be more suitable when available.
After the tablespace is dropped, querying DBA_DATA_FILES in the current database does not return its removed file entries. Obtain the historical file map from backup records, a saved structural inventory, the recovery catalog if available, or a suitably restored control file.
Once mounted with the restored control file, appropriate fixed views such as V$DATAFILE and V$TABLESPACE can help inspect that structure. Include container identity. Dictionary queries against DBA_TABLESPACES and DBA_DATA_FILES belong later, in the opened PDB that owns STUDENT.
Similarly, recording the current redo sequence does not prove that recovery reached the desired endpoint. Thread, incarnation, redo coverage, and actual availability matter, as explained in Lesson 7.
The main procedure assumes a whole CDB in ARCHIVELOG mode, a usable current SPFILE or PFILE, accessible disk backups and required redo, and the necessary encryption keys or passwords. The target and selected control-file backup belong to the current incarnation. Ancestor-incarnation recovery requires additional handling.
Connect RMAN to the target CDB/root recovery context using appropriate SYSBACKUP or SYSDBA privileges. Preserve useful current-state records before replacing the current control file. Record the database identity, backup locations, file map, target evidence, and any configuration needed to access encrypted backups.
When a valid control file is still mounted or the database is open, the following query records the DBID:
SELECT dbid, name FROM v$database;
If every current control file has already been lost, this query is not a solution in NOMOUNT state. Use reliable saved RMAN output, autobackup naming information, or repository records associated with the correct database.
Stop application services, scheduled writers, active work, and automatic reconnections according to the operating plan. ENABLE RESTRICTED SESSION limits new logins without the required privilege; it does not terminate existing sessions and applies only to the current instance. It is not a complete write freeze.
If the database is open and can shut down normally, use SHUTDOWN IMMEDIATE;. Confirm that the instance is stopped before beginning the following example. Preserve surviving online redo needed for recovery; do not overwrite it with old files from a blanket backup-directory copy.
This NOCATALOG example uses a known disk backup piece containing the selected control file from before the DROP. Its DBID and path are illustrative and must be replaced with verified values. The initialization file must already be able to start the instance.
SET DBID 1234567890;
STARTUP NOMOUNT;
RESTORE CONTROLFILE FROM '/u02/backup/controlfile_20250120.bkp';
ALTER DATABASE MOUNT;
NOMOUNT starts the instance without mounting the control files being replaced. RESTORE CONTROLFILE writes the selected binary backup to the configured CONTROL_FILES destinations. Confirm that those locations are writable; a failed disk or relocation requires the appropriate configuration changes before mounting.
If the SPFILE or PFILE is also unavailable, establish the initialization parameters through the documented parameter-file recovery procedure first. The command above assumes that preparation is complete.
After mounting, check that the restored metadata identifies the required structure and backups. The older control file may not know later backup pieces or changed paths. If necessary, catalog verified disk files or a carefully selected staging prefix:
CATALOG START WITH '/u02/backup/';
Review the files offered for cataloging. This conditional step supplies repository information; it does not validate every backup or prove that all required redo exists. A connected recovery catalog may provide the missing history instead.
With the correct control file mounted and required backup information available, use the verified recovery target for both data file selection and recovery:
RUN {
SET UNTIL TIME "TO_DATE('2025-01-21 14:04:00', 'YYYY-MM-DD HH24:MI:SS')";
RESTORE DATABASE;
RECOVER DATABASE;
}
SET UNTIL precedes both RESTORE and RECOVER. The control-file piece was already explicitly selected as suitable for the target; the RUN block now governs the restored data files and their recovery endpoint.
Restore all required data files for the whole-CDB target, including files outside STUDENT. Their backups may have different ages, but all must support recovery to the selected state. Forward media recovery cannot roll an unsuitable later file backward.
RECOVER applies the required incremental changes and redo. RMAN handles the restored control file without a SQL*Plus USING BACKUP CONTROLFILE clause. Treat these stages as supervised operations and resolve errors before proceeding to RESETLOGS.
Required redo depends on the data files' starting states and the target, together with recovery metadata. An older restored data file can need redo from before the control-file backup. The control file's backup time alone does not define the required redo interval.
RMAN attempts to find relevant archived and online redo absent from the older repository. Changed paths or missing records can require intervention. RMAN-06054 identifies a requested log unknown to the repository; investigate its actual availability and metadata before treating it as irrecoverable loss.
If the control-file backup predates file additions, recovery must reconcile that structure. RMAN can handle file creation from redo in supported cases. User-managed recovery may stop for file identification or creation. Neither procedure guarantees reconstruction regardless of available backups and redo.
Do not use V$RECOVER_FILE as the completion test for this workflow. Oracle documents that a restored control file lacks information needed to update that view accurately. File-header evidence from V$DATAFILE_HEADER can help, but it does not validate every data block or the business result.
Inspect the recovery output and alert log, and resolve warnings that reopening would fail. After successful recovery to an acceptable consistent state, open the CDB:
ALTER DATABASE OPEN RESETLOGS;
Then open the intended PDBs. If all applicable PDBs should open, a root SQL*Plus session can issue ALTER PLUGGABLE DATABASE ALL OPEN;. Check the actual states:
SELECT name, open_mode, controlfile_type FROM v$database;
SELECT name, open_mode FROM v$pdbs ORDER BY con_id;
Connect to the opened PDB that owned STUDENT and inspect the recovered tablespace and its files:
SELECT tablespace_name, status
FROM dba_tablespaces
WHERE tablespace_name = 'STUDENT';
SELECT tablespace_name, file_name
FROM dba_data_files
WHERE tablespace_name = 'STUDENT';
Validate CUSTOMERS under its actual owner using representative customer keys, important attributes, and relationships. Confirm that the earlier updates are present. Finding a matching tablespace name or obtaining a row count alone does not prove that the expected application state was recovered.
Keep application access controlled until those checks are complete. RESETLOGS establishes a new incarnation and restarts redo sequencing; it does not reset database SCNs or DBID to 1. RESETLOGS_TIME records the reopening event, not the historical 14:04 target.
The main example uses a known piece. Other acquisition methods require different repository and search preparation:
| Method | Preparation |
|---|---|
| NOCATALOG, known piece | Use the verified handle and DBID. A tag is not interchangeable with the handle in this NOMOUNT context. |
| Autobackup outside the FRA | Establish DBID, device access, the actual format, and an appropriate search period. |
| Autobackup in the FRA | Follow the location-dependent discovery rules, which can avoid SET DBID. |
| Recovery catalog | Use its backup history. SET DBID remains necessary to disambiguate a nonunique database name. |
| SBT storage | Supply the actual media-manager or cloud-module channel configuration and credentials. |
Autobackup formats and search limits must match the stored files. A default present-day search does not automatically locate January 2025 backups. For this scenario, verify that the selected control file describes STUDENT before the DROP; the latest backup is not automatically suitable.
RESTORE CONTROLFILE TO a separate filename creates a copy there. It does not automatically switch the running instance to that file. Configured locations and mount state still matter, and active control files must not be overwritten while mounted or open.
For a separate user-managed workflow, restore the appropriate binary control file to every configured destination while stopped, restore suitable data files, and mount the CDB. Then use this SQL*Plus command for the same verified target:
RECOVER DATABASE UNTIL TIME '2025-01-21:14:04:00' USING BACKUP CONTROLFILE
The timestamp has a colon between date and time. Supply the requested archives and, where needed, the verified online redo member. The backup control file may contain older log information, so a suggested filename is not a substitute for checking identity and availability.
Apply the reopening and validation requirements described above. If recovery must be canceled, cancellation alone does not establish consistency. This SQL*Plus command belongs to the alternative workflow, not after the RMAN procedure.
While a usable control file exists, these commands create different recovery resources:
ALTER DATABASE BACKUP CONTROLFILE TO '/u02/backup/controlfile_binary.ctl';
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
The first produces a binary backup. The second writes SQL for recreating a control file, without all the repository and history information preserved by a binary backup. A trace script cannot be mounted as a control file.
These preparation commands cannot manufacture a historical backup after the DROP. CREATE CONTROLFILE has its own recovery and opening requirements, so it should not be substituted casually into the restore procedure.
A fresh database backup after RESETLOGS is optional in Oracle 26ai. It can establish a useful baseline under the backup policy and does not inherently require another shutdown in ARCHIVELOG mode. Earlier backups remain usable with the necessary recovery chain and incarnation metadata.
Identify valid commits excluded after the chosen endpoint, including work performed while the incident was investigated. The loss interval is not necessarily exactly ten minutes, and whole-CDB recovery affects more than CUSTOMERS.
Reconcile authoritative business records before replaying transactions. Payments, messages, and remote systems may retain effects that the recovered CDB no longer records. Blind re-entry can duplicate those effects.
Review control-file multiplexing, autobackups, off-host protection, saved DBID and backup-location records, and restore testing. Verify the actual configuration; enabling autobackups now does not create older backups. Coordinate any Data Guard or flashback recovery requirements with the preserved recovery history.
The next lesson explains recovery when the current online redo log is lost.