| RMAN : Block-Level Media Recovery - Concept & Example [ID 144911.1] | |||||
| 修改时间 26-MAR-2012 类型 BULLETIN 状态 PUBLISHED | |||||
2.在没有RMAN备份的情况下执行RMAN BWR。
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.
%rman target /
RMAN> catalog datafilecopy '';
catalog archivelog '';
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.
Starting from 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$DATABASE_BLOCK_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
| HOW TO PERFORM. BLOCK MEDIA RECOVERY (BMR) WHEN BACKUPS ARE NOT TAKEN BY RMAN. [ID 342972.1] | |||||
| 修改时间 19-DEC-2011 类型 HOWTO 状态 PUBLISHED | |||||
In this Document
Goal
Solution
To Perform. Block Media Recovery (BMR) when there are OS-backups available, but NO RMAN backups.
Consider that a block corruption is reported in the database and the corruption is not wide spread.
Since RMAN is not used in the database the initial solution would be to restore the file from backup and then recover. But this method will require the file should be offline during the entire process. On the other hand if BMR can be used, the file does not need to be taken offline.
This document describes to how to use the OS backup via RMAN and then to perform. the BMR.
-----------
The backups can be cataloged with RMAN and then BMR can be performed.
Step 1 : Identify the backup of the datafilefile which has the corrupted block(s) and catalog it within RMAN.
Example: Backup is /u01/backup/users01.dbf
Step 2 : Check the archived redologs.
RMAN is using the archived redologs which are known in V$ARCHIVED_LOG. If the archivelog files are not
reported in V$ARCHIVED_LOG because they are moved to another location, or aged out of the controlfile,
then they need to be cataloged as well.
| OERR: ORA-1578 "ORACLE data block corrupted (file # %s, block # %s)" Master Note [ID 1578.1] |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23135684/viewspace-722332/ ,如需转载,请注明出处,否则将追究法律责任。