Flash Recovery using Image Copy
Image Copy
Oracle RMAN image copies are exact copies of the datafiles, with all the blocks—used or not. Oracle RMAN takes this image copy while the database is up and running, and the database need not be put into any special mode.
Here is how to make an Oracle RMAN image copy backup:
run {
backup as copy
database; }
|
Instant Recovery Image copies in the FRA become truly useful when you need an "instant recovery." Remember that these image copies are copies of the datafiles—a fact recorded in the Oracle RMAN catalog and the control file. In case of a disaster, you don't need to restore the file; you can use the copy as the principal datafile immediately.Here is the description of the recovery process, assuming that the USERS tablespace has been damaged: First, check the file ID (number) and name of the datafile of the tablespace. The output is shown in vertical format:
select file_id, file_name from dba_data_files where tablespace_name = 'USERS';
FILE_ID : 4 NAME : /home/oracle/oradata/PRODB2/ users01.dbf |
RMAN> sql 'alter tablespace users offline';
sql statement: alter tablespace users offline RMAN> switch datafile 4 to copy; datafile 4 switched to datafile copy "/home/oracle/FRA/PRODB2/datafile/o1_mf_users_2kmqr57t_.dbf" RMAN> recover datafile 4; Starting recover at 26-SEP-06 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:03 Finished recover at 26-SEP-06 RMAN> sql 'alter tablespace users online'; sql statement: alter tablespace users online |
Switchback Even though the datafile has been quickly brought online to minimize downtime, it is now in the backup location, which may be on slower disks than what the main database is on. You may not want to run the database with the datafile at this location for long; you would typically want to move the datafile back to the original location—/home/oracle/oradata/PRODB2/—as soon as it becomes available. You can use Oracle RMAN to accomplish this. Here is a summary of the steps: 1. Make an image copy of the datafile at the original location. 2. Take the tablespace offline. 3. Switch the datafile to the "copy" (however, in this case, the "copy" is at the original location). 4. Recover the tablespace. 5. Place the tablespace online. These steps are presented in Listing 4. After the switchover, you can make sure the datafile is back in its original location:select name from v$datafile where file# = 4; NAME --------------------------------------- /home/oracle/oradata/PRODB2/users01.dbf
RMAN> backup as copy datafile 4 format '/home/oracle/oradata/PRODB2/users01.dbf';
|
In case of a failure, you save valuable time by quickly using the image copy of the datafile in the FRA, and there is no need to restore it first. The same concept can be applied to the entire database as well. If the original location of all the datafiles is damaged, you can easily switch the entire database to the copy stored in the FRA. To switch to the FRA copy, issue the following, which directs the whole database to use all the latest image copies in the FRA location as its datafiles:RMAN> switch database to copy;
No comments:
Post a Comment