Subject: RMAN 9i: Block-Level Media Recovery - Concept & Example Type: BULLETIN Status: PUBLISHED Content Type: TEXT/PLAIN Creation Date: 09-MAY-2001 Last Revision Date: 18-JUN-2001 PURPOSE ------- Explanation and examples of RMAN Block-level Media Recovery SCOPE & APPLICATION ------------------- For Analysts and customers wanting to understand the concept and use of Block Level Recovery with RMAN Block-Level Media Recovery ----------------------------- Block-level Media Recovery is most useful in situations where only a small subset of blocks in a datafile need media recovery. Before Oracle9i if a single block required recovery the DBA would need to restore the complete datafile and apply all redo changes. Recovery time is reduced as only blocks needing recovery need to be restored from backup and only the required set of corrupt blocks undergo redo application. Data blocks undergoing media recovery are inaccessible to queries or DML because they are media corrupt, but the datafile itself remains online. This is a significant availability improvement over file-level recovery, where the entire datafile is offline for the duration of the recovery. Blocks undergoing recovery are not visible to users until the recovery process is complete. Recovery Manager Interface RMAN will support BMR via the new BLOCKRECOVER command: BLOCKRECOVER bmr_block_specifier_list bmr_option_list; bmr_block_specifier_list: bmr_block_specifier | bmr_block_specifier_list bmr_block_specifier bmr_block_specifier: DATAFILE datafile_specifier BLOCK block_list | TABLESPACE tablespace_specifier DBA dba_list CORRUPTION LIST datafile_specifier: text_string | integer block_list: integer | block_list , integer tablespace_specifier: text_string dba_list: integer | dba_list , integer bmr_option_list: bmr_option | bmr_option_list | bmr_option bmr_option: from backupset | from datafilecopy | from tag text_string | restore until time_clause | nofileupdate | save final blocks | save all blocks time_clause: TIME date_string | SCN integer | LOGSEQ integer THREAD integer This command will identify the backups from which to obtain the blocks to recover. If the user has never used RMAN before with this database, and their only existing backups are image copies taken with v7 methods, they should use the catalog datafilecopy command to identify those files to RMAN prior to using the blockrecover command.. The catalog archivelog command may also be required to specify restored archives. In some cases it may be necessary for the customer to first configure the catalog if they are not using RMAN at all. If the user has backups or archivelogs that need to be restored from tape, they should allocate the required channel(s) before the blockrecover command. Archivelog restores for BMR can be run in parallel on multiple channels, but datafile/backupset scans and the recovery session must all run in the same server session. To allow selection of which backup will be used to select the desired blocks, the blockrecover command supports options used in the restore command: from backupset -- restore blocks from backupsets only from datafilecopy -- restore blocks from datafile copies only from tag -- restore blocks from tagged backup restore until time|scn|logseq -- limit search to backups made at or before this time. In 9.0.1, a new view, v$database_block_corruption, will reflect the blocks that were found to be corrupted since the last RMAN backup. Examples: How to identify blocks needing recovery: SQL> select * from mine; select * from mine * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 5, block # 114) ORA-01110: data file 5: '/u02/oradata/DB1/users01.dbf' Or use RMAN to populate the v$backup_corruption view. RMAN> run {BACKUP VALIDATE DATABASE;} Starting backup at 09-MAY-01 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00002 name=/u02/oradata/DB1/undotbs01.dbf input datafile fno=00003 name=/u02/oradata/DB1/indx01.dbf input datafile fno=00005 name=/u02/oradata/DB1/users01.dbf input datafile fno=00008 name=/u02/oradata/DB1/repcat01.dbf input datafile fno=00004 name=/u02/oradata/DB1/tools01.dbf channel ORA_DISK_2: starting full datafile backupset channel ORA_DISK_2: specifying datafile(s) in backupset including current controlfile in backupset input datafile fno=00001 name=/u02/oradata/DB1/system01.dbf input datafile fno=00006 name=/u02/oradata/DB1/joanes/joanes_1.dbf input datafile fno=00007 name=/u02/oradata/DB1/joanes/joanes_test_1.dbf channel ORA_DISK_1: backup set complete, elapsed time: 00:01:28 channel ORA_DISK_2: backup set complete, elapsed time: 00:01:54 Finished backup at 09-MAY-01 Result: SQL> select * from V$backup_corruption; RECID STAMP SET_STAMP SET_COUNT PIECE# FILE# BLOCK# ---------- ---------- ---------- ---------- ---------- ---------- ---------- BLOCKS CORRUPTION_CHANGE# MAR ---------- ------------------ --- 1 429201733 429201725 8 1 5 114 1 0 YES Perform Block Level Recovery by either explicitly identifying the file and block to be recovered or use the corruption list - v$backup_corruption Recovery using Explicit File/Block: $ rman catalog rman/rman@DB2 target / log=rman1.log RMAN> run {blockrecover datafile 5 block 114;} RMAN> exit Recovery Manager: Release 9.0.0.0.0 - Beta (c) Copyright 2000 Oracle Corporation. All rights reserved. connected to target database: DB1 (DBID=1021434286) connected to recovery catalog database RMAN> Starting blockrecover at 08-MAY-01 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=8 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=7 devtype=DISK channel ORA_DISK_1: restoring block(s) channel ORA_DISK_1: specifying block(s) to restore from backup set restoring blocks of datafile 00005 channel ORA_DISK_1: restored block(s) from backup piece 1 piece handle=/u02/oradata/DB1/joanes/04cp9jk9_1_1 tag=null params=NULL channel ORA_DISK_1: block restore complete channel ORA_DISK_1: block restore complete starting media recovery media recovery complete Finished blockrecover at 08-MAY-01 Recovery using Corruption list : RMAN> run {blockrecover corruption list;} Starting blockrecover at 08-MAY-01 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: restoring block(s) channel ORA_DISK_1: specifying block(s) to restore from backup set restoring blocks of datafile 00005 channel ORA_DISK_1: restored block(s) from backup piece 1 piece handle=/u02/oradata/DB1/joanes/08cpa69t_1_1 tag=null params=NULL channel ORA_DISK_1: block restore complete channel ORA_DISK_1: restoring block(s) channel ORA_DISK_1: specifying block(s) to restore from backup set restoring blocks of datafile 00005 channel ORA_DISK_1: restored block(s) from backup piece 1 piece handle=/u02/oradata/DB1/joanes/04cp9jk9_1_1 tag=null params=NULL channel ORA_DISK_1: block restore complete starting media recovery media recovery complete Finished blockrecover at 08-MAY-01 RELATED DOCUMENTS ----------------- Function Specifications for Block Media Recovery