Backup Options   «Prev  Next»
Lesson 6 Restoring files to an alternative location
Objective Restore files to a different location after media failure.

Restoring Files to an Alternative Location

In an earlier lesson, you learned how to recover a database by restoring backup files after a media failure occurs and is corrected. However, if a media failure cannot be corrected in time and it is necessary to have the database operating, you can restore the backup files to an alternative location in order to make the database accessible.

Restoring files to a different location

Restoring backup files to a different location involves a few simple steps. As you learned earlier in this module, all of the datafiles, control files, and redo log files must be restored, not just the damaged files. This will guarantee that the entire database is synchronized to a single point in time and functions properly. View the code below to see how to restore backup files to a different location.
You may also preview all the steps.
View the code below to see all of the code you would normally see on your screen when you restore files to an alternate location.
SVRMGR>
SVRMGR> SHUTDOWN ABORT
ORACLE instance shut down.
SVRMGR> HOST
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.

C:\>COPY D:\ORCL_BCKUP\*.* D:\ORCL_NEW
D:\ORCL_BCKUP\Ctl1orcl.ora
D:\ORCL_BCKUP\LOG1ORCL.ORA
D:\ORCL_BCKUP\LOG2ORCL.ORA
D:\ORCL_BCKUP\LOG3ORCL.ORA
D:\ORCL_BCKUP\LOG4ORCL.ORA
D:\ORCL_BCKUP\OEM1ORCL.ORA
D:\ORCL_BCKUP\RBS1ORCL.ORA
D:\ORCL_BCKUP\SYS1ORCL.ORA
D:\ORCL_BCKUP\TMP1ORCL.ORA
D:\ORCL_BCKUP\Usr1orcl.ora
       10 file(s) copied.

    
C:\>HOST
SVRMGR> STARTUP MOUNT PFILE=D:\ORANT\DBS\INITORCL.ORA
ORACLE instance started.
Total System Global Area                         15077376 bytes
Fixed Size                                          49152 bytes
Variable Size                                    12906496 bytes
Database Buffers                                  2048000 bytes
Redo Buffers                                        73728 bytes
Database mounted.
SVRMGR> ALTER DATABASE RENAME FILE 
     2> 'C:\ORANT\DATABASE\USR1ORCL.ORA'
     3> TO 'D:\ORCL_NEW\USR1ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\SYS1ORCL.ORA'
     3> TO 'D:\ORCL_NEW\SYS1ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\OEM1ORCL.ORA'
     3> TO 'D:\ORCL_NEW\OEM1ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\LOG4ORCL.ORA'
     3> TO 'D:\ORCL_NEW\LOG4ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\LOG3ORCL.ORA'
     3> TO 'D:\ORCL_NEW\LOG3ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\LOG2ORCL.ORA'
     3> TO 'D:\ORCL_NEW\LOG2ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE RENAME FILE
     2> 'C:\ORANT\DATABASE\LOG1ORCL.ORA'
     3> TO 'D:\ORCL_NEW\LOG1ORCL.ORA';
Statement processed.
SVRMGR> ALTER DATABASE OPEN;
Statement processed.
SVRMGR>

The next lesson concludes this module.


RMAN: Restoring and Recovering Control Files

Because of media failure, we can lose control files as well as datafiles and redo log files. This section will go over different scenarios with control file loss and practical recovery procedures.

Recovering from the Loss of a Control File When a Mirrored Copy is Available

It is always best to have backup copies of the control files. Oracle recommends having at least three copies of the control file at all times. It is recommended to multiplex control files to different physical disks so that if one of them is lost due to media failure, it can be restored from the other physical disks.
Please note that more than three copies can be made, but here, the more the merrier? is not the right thing to do. If multiplexed copies of the control file are going to be made and the database is doing a huge amount of control file updates, it would lead to the Control File Parallel Write wait event and also the Control File Enqueue will come into contention. So it is always better to use just the number of copies needed. If more than the maximum of eight copies of control files are made, the following error will occur:

ORA-00208: number of control file names exceeds limit of 8
If there is just one lost copy of the mirrored files, there is much less to do. See what happens in the following scenarios with our resident DBA, Bob:
1st Scenario
Due to media failure, Bob lost one of the control files of the database and got the following error:
ERROR at line 1:
 ORA-00210: cannot open the specified control file
 ORA-00202: control file: '/u02/oradata/db1/control01.ctl'
 ORA-27041: unable to open file
 Linux Error: 2: No such file or directory
 Additional information: 3

As Glenn has multiplexed controlfiles on the different hard drives, he performs the following actions:
  1. Shuts down the database (in abort mode)
  2. Copies available control file to the directory where the file was lost and renames it
  3. Starts the database
Here are the steps in detail to recover the database:
If the database is already up, bring it down immediately without invoking the checkpoint.
SQL> shut abort;