Recover database from the downloaded backup data



After the backup data is downloaded, the DBA can run RMAN scripts to fetch backup data from the restore location and restore the database on the required Oracle server host. To proceed with the database recovery, the DBA must have permission to access the restore directory and its parent directory.
To recover a database, ensure that the control file in the current database is intact. If the control file is damaged, you must identify the control file from the downloaded backup data and proceed with the recovery.
Procedure
The following section provides instructions to recover the database from the downloaded backup data:
Recover database when the control file is intact
- Shut down the active database.
- Mount the database to initiate RMAN operations.
- Open RMAN command prompt using the following command:
$rman target <user>/<password>@<host_name>/<database_name>
where,- <user> has the SYSDBA privileges,
- <password> denotes the password to connect as SYSDBA specified in the target database’s orapwd file.
Example: $rman target sys/oracle@localhost/cdb01
- Configure the SBT channel and provide the Druva SBT library present at the /opt/Druva/PhoenixOracle/lib/libphxsbt.so location.
- Run the following command:
configure channel device type sbt PARMS 'SBT_LIBRARY=/opt/Druva/PhoenixOracle/lib/libphxsbt.so,SBT_PARMS=(LogDirSuffix=restore_logs;RestoreFromLocalDir=/restore/Thu-Jan-28-14-16-43-2021)';
where,- LogDirSuffix is the directory to save the restore logs.
- RestoreFromLocalDir is the directory where you have downloaded the backup data.
Note: After the control file is restored from the previous backup, the control file might contain the history of archived logs, which were backed up and deleted by the subsequent backups. Because the control file refers to the old archived logs, which no longer exist on the system, it is recommended to execute the following RMAN command after the control file restore:
RMAN> crosscheck archivelog all;
- Restore the database.
- Recover the database.
- Open the database using the alter database open command.
- Check the status of the database after it is recovered.
- Back up the database based on your requirement.
Recover database when the control file is damaged
- Identify the control file from the downloaded backup data. The control file from the backup data has the following name format:
Phx_<DBID>_<IncarnationNo>_CF
Example: Phx_DN-SP01_DBID-1660729487_DT-20210128-142756_govlp4ld_1_1_CF - Shut down the active database and bring the database to the NOMOUNT state.
- Open RMAN command prompt and restore the control file. Run the following command:
run
{ allocate channel ch0 device type sbt PARMS 'SBT_LIBRARY=/opt/Druva/PhoenixOracle/lib/libphxsbt.so,SBT_PARMS=(LogDirSuffix=restore_logs;RestoreFromLocalDir=/restore/Thu-Jan-28-05-02-29-2021)';
restore controlfile from 'Phx_DN-SP01_DBID-1660729487_DT-20210128-051550_envlo45s_1_1_CF';
}
Where, - Mount the database to initiate RMAN operations.
- Configure the SBT channel.
Note: After the control file is restored from the previous backup, the control file might contain the history of archived logs, which were backed up and deleted by the subsequent backups. Because the control file refers to the old archived logs, which no longer exist on the system, it is recommended to execute the following RMAN command after the control file restore:
RMAN> crosscheck archivelog all; - Restore the database.
- Recover the database.
- Open the database using the resetlogs option because we restored the control file. Verify the database incarnation.
- Check the status of the database after it is recovered.
- Back up the database based on your requirement.