在Oracle的恢复中都要考虑是在归档模式的恢复,还是非归档模式的恢复。使用RMAN的BMR修复数据坏块的前提条件是要求数据库在归档模式下。这篇文章我们就讨论归档模式下使用RMAN的BMR进行坏块的恢复。
以下的内容对于我们熟练使用RMAN的BMR修复数据坏块非常的重要!
1.RMAN的BMR的概念和使用例子:
RMAN : Block-Level Media Recovery - Concept & Example [ID 144911.1] | |||||
| |||||
修改时间 26-MAR-2012 类型 BULLETIN 状态 PUBLISHED |
Applies to:
Oracle Server - Standard EditionOracle Server - Personal Edition
Oracle Server - Enterprise Edition - Version: 9.0.1.0 and later [Release: 9.0.1 and later]
**Checked for relevance on 26-Mar-2012***
Purpose
Explanation and examples of RMAN Block-level Media RecoveryScope and Application
For Analysts and customers wanting to understand the concept and useof Block Level Recovery with RMAN
RMAN : Block-Level Media Recovery - Concept & Example
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> 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:
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.
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:
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> 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 :
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
2.在没有RMAN备份的情况下执行RMAN BWR。
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
Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 10.2.0.1 - Release: 9.2 to 10.2Information in this document applies to any platform.
Goal
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.
Solution
-----------
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
$ RMAN target=/
RMAN> catalog datafilecopy ‘/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.
RMAN> crosscheck archivelog all;
RMAN> delete expired archivelog all;
Then catalog the unknown archived redologs :
RMAN> catalog archivelog ‘/u01/backup/archivelog/Arch_ocl_1_30.dbf’
Step 3 : Preform. the BMR
Having datafile(s) and all required archivelogs cataloged, we can run BMR as follows.
RMAN> blockrecover datafile 5 block 99,100,101;
更多详细的内容请参考文章:《
OERR: ORA-1578 "ORACLE data block corrupted (file # %s, block # %s)" Master Note [ID 1578.1] |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23135684/viewspace-722332/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23135684/viewspace-722332/