Environment: Oracle Database 19c
This procedure applies when all three
conditions are true:
• No
control file backup exists (neither RMAN autobackup nor manual copy)
• RMAN
datafile backups are available
• Archived
redo logs are available and span the required SCN range
Objective: Recreate the control file, re-register RMAN
backup metadata, restore datafiles from backup, and apply archived logs to
reach a consistent, openable state.
Step 1 — Recreate the Control File
Start the instance in NOMOUNT mode.
The database must not be mounted while recreating the control file.
If a trace file was previously
generated, locate it in the Oracle diagnostic destination (ADR):
The trace file contains two CREATE
CONTROLFILE variants: one with RESETLOGS and one with NORESETLOGS. Always use
the RESETLOGS variant when the control file has been lost — the NORESETLOGS
form requires all original online redo logs to be intact, which is not
guaranteed in a recovery scenario.
Execute the RESETLOGS variant:
CREATE CONTROLFILE REUSE DATABASE
"ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 200
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/d01/oradata/orcl/redo01.log' SIZE 200M,
GROUP 2 '/d01/oradata/orcl/redo02.log' SIZE 200M,
GROUP 3 '/d01/oradata/orcl/redo03.log' SIZE 200M
DATAFILE
'/d01/oradata/orcl/system01.dbf',
'/d01/oradata/orcl/sysaux01.dbf',
'/d01/oradata/orcl/undotbs01.dbf',
'/d01/oradata/orcl/users01.dbf'
CHARACTER SET AL32UTF8;
NOTE
All datafile paths must exactly match
the current filesystem. Missing even one datafile will cause the statement to
fail.
All online redo log paths must also
match — Oracle validates them at mount time.
If no trace file exists, construct the
CREATE CONTROLFILE statement manually using V$DATAFILE and V$LOGFILE from any
surviving instance, or from the last known backup catalog.
Step 2 — Mount the Database
After the control file is created,
mount the database:
ALTER DATABASE MOUNT;
The control file structure is now in
place, but it contains no RMAN backup metadata — the repository is empty
because this is a newly created control file.
Step 3
— Catalog Existing RMAN Backup Pieces
Scan the backup storage location(s) to
re-populate the RMAN repository in the new control file:
RMAN> CATALOG START WITH
'/backup_location/' NOPROMPT;
CATALOG START WITH recursively scans
the specified path, identifies valid backup pieces and archive logs, and
records them in the control file repository. Run once per storage location if
backups span multiple directories.
If a Recovery Catalog database is
configured, connect RMAN to it using CATALOG CONNECT — the metadata is already
stored externally and this step is not required.
Step 4
— Restore the Datafiles
Restore all datafiles from the
cataloged backups:
RMAN> RESTORE DATABASE;
RMAN selects the most recent full or
incremental backup set for each datafile and writes them to the configured
datafile destinations.
Step 5
— Recover the Database
Apply archived redo logs to roll the
restored datafiles forward to a consistent SCN:
RMAN> RECOVER DATABASE;
Oracle automatically determines the
required archived log sequence range. If any archived log is missing, recovery
will halt at that SCN. Verify log availability with LIST ARCHIVELOG ALL; before
proceeding.
Step 6
— Open the Database
Open the database, resetting the redo
log sequence to start a new log incarnation:
ALTER DATABASE OPEN RESETLOGS;
RESETLOGS is mandatory when opening
after control file recreation. It resets the online redo log sequence number to
1 and invalidates all archived logs from the previous incarnation. Back up the
database immediately after opening.
Important Note:
Do not attempt to use archived logs
from before the RESETLOGS point in any future recovery against this incarnation
— they belong to a prior incarnation and will be rejected.
Recovery Catalog
When an RMAN Recovery Catalog is
configured, Step 3 (CATALOG START WITH) is not required. Connect RMAN to the
catalog with CATALOG CONNECT target /; — the catalog already holds the full
backup metadata and will resync with the new control file automatically.
Backup Immediately After Recovery
After OPEN RESETLOGS, the existing
backups can no longer be used to recover beyond the RESETLOGS SCN. Take a full
RMAN backup of the database and archived logs immediately.
Best Practice — Prevent Recurrence
Enable RMAN control file autobackup to
ensure the control file and SPFILE are backed up automatically after every
backup or structural change:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
Autobackup stores the control file to
the configured DB_RECOVERY_FILE_DEST or a custom CONFIGURE CONTROLFILE
AUTOBACKUP FORMAT path. Verify with SHOW CONTROLFILE AUTOBACKUP;
Comments
Post a Comment