In this example scenario:
RMAN was making backups into the /oracle/rman/ directory, at the same time backups were being copied onto a different machine on the network.
The disk with the /oracle/rman/ directory has failed, making the backups unavailable. Backups were then copied to /oracle/rman1/.
At the same time:
The “oratr” disk /oracle/oradata/oratr/ which contains the redologs, controlfiles and datafiles has also failed. A new disk is installed and mounted on the yenioratr directory /oracle/oradata/yenioratr.
This is illustrated here:
Step 1: Delete dbf, redo logs and control files in order to implement the scenario.
3- rm *
ORACLE instance started.
Total System Global Area 910163968 bytes
Fixed Size 1283380 bytes
Variable Size 230689484 bytes
Database Buffers 675282944 bytes
Redo Buffers 2908160 bytes
ORA-00205: error in identifying control file, check alert log for more info
Step 2: As part of the scenario, backups that were made to the /oracle/rman folder using rman need to be moved to another disk/folder (making a copy of the directory on the network).
By restoring the backups to a different location we can now recover the database.
Step 3: Restoring the controlfile to a new location.
set controlfile autobackup format for device type disk to ‘/oracle/rman1/%F’;
RESTORE CONTROLFILE TO ‘/oracle/oradata/neworatr/control01.ctl’ from autobackup;
RESTORE CONTROLFILE TO ‘/oracle/oradata/neworatr/control02.ctl’ from autobackup;
RESTORE CONTROLFILE TO ‘/oracle/oradata/neworatr/control03.ctl’ from autobackup;
Had the restore been to the first location, i.e. if /oracle/oradata/oratr/ was in a good condition the following command could have been used:
Note: The new control file paths need to be written to pfile.ora in order to re-open the database with the updated spfile. RMAN would then need to be reconnected in mount mode.
Check the updated control file paths using the following query:
Step 4: The new backups need to be identified to RMAN because location where the backups are now stored in a different location.
CATALOG BACKUPPIECE ‘/oracle/rman1/ora_df_752578940_69_1’;
CATALOG BACKUPPIECE ‘/oracle/rman1/ora_df_752578825_68_1’;
CATALOG BACKUPPIECE ‘/oracle/rman1/ora_df_752578823_67_1’;
CATALOG BACKUPPIECE ‘/oracle/rman1/ora_df_752578814_66_1’;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘/oracle/rman1/ora_df_%t_%s_%p’;
Step 5: Updating the control file with the redo log directories. (This step may need to be done after Step 6)
sql> alter database rename file ‘/oracle/oradata/oratr/redo02.log’ to ‘/oracle/oradata/neworatr/redo02.log’ ;
sql> alter database rename file ‘/oracle/oradata/oratr/redo03.log’ to ‘/oracle/oradata/neworatr/redo03.log’ ;
Step 6: Restore and recover the datafiles, start the server using open reset logs. (We use reset logs because there aren’t any redo logs)
set pagesize 100
select ‘set newname for datafile ‘||file_id||’ to ”’||’/oracle/oradata/yenioratr/’||”’;’ from dba_data_files;
select ‘set newname for tempfile ‘||file_id||’ to ”’||’/oracle/oradata/yenioratr/’||”’;’ from dba_temp_files;
set newname for datafile 1 to ‘/oracle/oradata/neworatr/system01.dbf’;
set newname for datafile 2 to ‘/oracle/oradata/neworatr/undotbs01.dbf’;
set newname for datafile 3 to ‘/oracle/oradata/neworatr/sysaux02.dbf’;
set newname for datafile 4 to ‘/oracle/oradata/neworatr/users01.dbf’;
set newname for datafile 5 to ‘/oracle/oradata/neworatr/example01.dbf’;
switch datafile all;
alter database open resetlogs; }
from v$tablespace ts, v$datafile df
where ts.ts# = df.ts#;
Note: Use the following code in situations where the pfile, spfile or any other necessary files can’t be found:
restore spfile from autobackup;