RMAN深入解析之--BlockRecover恢复坏块

发布时间:2020-07-06 09:21:23 作者:客居天涯
来源:网络 阅读:1438

RMAN深入解析之--BlockRecover恢复坏块

案例环境:

操作系统:RedHat EL5

Oracle:  Oracle 11gR2


案例描述:

   通过块介质恢复(Block Media Recover:BMR)执行块级别的恢复操作来修复Oracle数据库上的逻辑或物理上损坏的数据块。

1、模拟数据块被破坏

10:26:48 SYS@ prod>conn scott/tiger
Connected.
10:26:51 SCOTT@ prod>select * from tab;
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BONUS                          TABLE
DEPT                           TABLE
EMP                            TABLE
EMP1                           TABLE
SALGRADE                       TABLE
Elapsed: 00:00:00.10
10:26:55 SCOTT@ prod>
10:27:37 SYS@ prod>desc dba_segments
 Name                                                              Null?    Type  
 ----------------------------------------------------------------- -------- -------------
 OWNER                                                                      VARCHAR2(30)
 SEGMENT_NAME                                                               VARCHAR2(81)
 PARTITION_NAME                                                             VARCHAR2(30)
 SEGMENT_TYPE                                                               VARCHAR2(18)
 SEGMENT_SUBTYPE                                                            VARCHAR2(10)
 TABLESPACE_NAME                                                            VARCHAR2(30)
 HEADER_FILE                                                                NUMBER
 HEADER_BLOCK                                                               NUMBER
 BYTES                                                                      NUMBER
 BLOCKS                                                                     NUMBER
 EXTENTS                                                                    NUMBER
 INITIAL_EXTENT                                                             NUMBER
 NEXT_EXTENT                                                                NUMBER
 MIN_EXTENTS                                                                NUMBER
 MAX_EXTENTS                                                                NUMBER
 MAX_SIZE                                                                   NUMBER
 RETENTION                                                                  VARCHAR2(7)
 MINRETENTION                                                               NUMBER
 PCT_INCREASE                                                               NUMBER
 FREELISTS                                                                  NUMBER
 FREELIST_GROUPS                                                            NUMBER
 RELATIVE_FNO                                                               NUMBER
 BUFFER_POOL                                                                VARCHAR2(7)
 FLASH_CACHE                                                                VARCHAR2(7)
 CELL_FLASH_CACHE                                                           VARCHAR2(7)
10:27:41 SYS@ prod>col segment_name for a20       
10:27:59 SYS@ prod>select owner,segment_name,SEGMENT_TYPE,HEADER_BLOCK from dba_segments      
10:29:06   2   where owner='SCOTT' and segment_name='EMP1';
OWNER                          SEGMENT_NAME         SEGMENT_TYPE       HEADER_BLOCK
------------------------------ -------------------- ------------------ ------------
SCOTT                          EMP1                 TABLE                       170

     通过以上查询,可以知道EMP1 table的segment header block为170;利用Uedit32,打开数据文件(users01.dbf)进行编辑破坏!


以下是计算block 170和block 171在Uedit32编辑中的offset:

10:29:24 SYS@ prod>select to_char(170*8*1024, 'xxxxxxxxxxxxxxxxxxxxx') from dual;

TO_CHAR(170*8*1024,'XX

----------------------

                154000


10:30:27 SYS@ prod>select to_char(171*8*1024, 'xxxxxxxxxxxxxxxxxxxxx') from dual;

TO_CHAR(171*8*1024,'XX

----------------------

                156000

以下是Uedit32编辑users01.dbf图片:

RMAN深入解析之--BlockRecover恢复坏块

通过转储数据块验证:

10:30:37 SYS@ prod>alter system dump datafile 4 block 170;

System altered.

 

[oracle@rh7 ~]$ ls -lt /u01/app/oracle/diag/rdbms/prod/prod/trace/|more

total 14300

-rw-r----- 1 oracle oinstall    4492 Jul 15 11:34 prod_ora_2883.trc
-rw-r----- 1 oracle oinstall      69 Jul 15 11:34 prod_ora_2883.trm
-rw-r----- 1 oracle oinstall  557756 Jul 15 10:17 alert_prod.log
-rw-r----- 1 oracle oinstall     947 Jul 15 10:17 prod_ckpt_2541.trc
-rw-r----- 1 oracle oinstall      59 Jul 15 10:17 prod_ckpt_2541.trm
-rw-r----- 1 oracle oinstall    1783 Jul 15 10:12 prod_j000_2588.trc
-rw-r----- 1 oracle oinstall      80 Jul 15 10:12 prod_j000_2588.trm

查看转储文件:

[oracle@rh7 ~]$ cat  /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_ora_2883.trc|more

Trace file /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_ora_2883.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1
System name:    Linux
Node name:      rh7
Release:        2.6.32-358.el6.x86_64
Version:        #1 SMP Tue Jan 29 11:47:41 EST 2013
Machine:        x86_64
Instance name: prod
Redo thread mounted by this instance: 1
Oracle process number: 26
Unix process pid: 2883, p_w_picpath: oracle@rh7 (TNS V1-V3)
*** 2014-07-15 11:34:50.092
*** SESSION ID:(37.32) 2014-07-15 11:34:50.092
*** CLIENT ID:() 2014-07-15 11:34:50.092
*** SERVICE NAME:(SYS$USERS) 2014-07-15 11:34:50.092
*** MODULE NAME:(sqlplus@rh7 (TNS V1-V3)) 2014-07-15 11:34:50.092
*** ACTION NAME:() 2014-07-15 11:34:50.092
 
Start dump data blocks tsn: 4 file#:4 minblk 170 maxblk 170
Block dump from cache:
Dump of buffer cache at level 4 for tsn=4, rdba=16777386
Block dump from disk:
buffer tsn: 4 rdba: 0x010000aa (4/170)
scn: 0x0000.001f891c seq: 0x02 flg: 0x04 tail: 0x891c2302
frmt: 0x02 chkval: 0x8eee type: 0x23=PAGETABLE SEGMENT HEADER
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F7DFC5C7A00 to 0x00007F7DFC5C9A00

7F7DFC5C7A00 0000A223 010000AA 001F891C 04020000  [#...............]

---此行内容与Uedit32打开内容一致

7F7DFC5C7A10 00008EEE 00000000 00000000 00000000  [................]
7F7DFC5C7A20 00000000 00000001 00000008 00000A9C  [................]
7F7DFC5C7A30 00000000 00000008 00000008 010000B0  [................]
7F7DFC5C7A40 00000000 00000000 00000000 00000008  [................]
7F7DFC5C7A50 00000000 00000000 00000000 00000000  [................]
7F7DFC5C7A60 00000008 00000008 010000B0 00000000  [................]
7F7DFC5C7A70 00000000 00000000 00000008 010000A8  [................]
7F7DFC5C7A80 010000A8 00000000 00000000 00000000  [................]
7F7DFC5C7A90 00000000 00000000 00000000 00000000  [................]
        Repeat 3 times
7F7DFC5C7AD0 00000001 00002000 00000000 00001434  [..... ......4...]
7F7DFC5C7AE0 00000000 010000A9 00000001 010000A8  [................]
7F7DFC5C7AF0 010000A9 00000000 00000000 00000000  [................]
7F7DFC5C7B00 00000000 00000000 00000001 00000000  [................]
7F7DFC5C7B10 0001257B 10000000 010000A8 00000008  [{%..............]
7F7DFC5C7B20 00000000 00000000 00000000 00000000  [................]
        Repeat 152 times
7F7DFC5C84B0 010000A8 010000AB 00000000 00000000  [................]
7F7DFC5C84C0 00000000 00000000 00000000 00000000  [................]
        Repeat 151 times
7F7DFC5C8E40 00000000 00000000 010000A9 00000000  [................]
7F7DFC5C8E50 00000000 00000000 00000000 00000000  [................]
        Repeat 185 times
7F7DFC5C99F0 00000000 00000000 00000000 891C2302  [.............#..]
  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 8     
                  last map  0x00000000  #maps: 0      offset: 2716  
      Highwater::  0x010000b0  ext#: 0      blk#: 8      ext size: 8     
  #blocks in seg. hdr's freelists: 0     
  #blocks below: 8     
  mapblk  0x00000000  offset: 0     
                   Unlocked
  --------------------------------------------------------
  Low HighWater Mark : 
      Highwater::  0x010000b0  ext#: 0      blk#: 8      ext size: 8     
  #blocks in seg. hdr's freelists: 0     
  #blocks below: 8     
  mapblk  0x00000000  offset: 0     
  Level 1 BMB for High HWM block: 0x010000a8
  Level 1 BMB for Low HWM block: 0x010000a8
  --------------------------------------------------------
  Segment Type: 1 nl2: 1      blksz: 8192   fbsz: 0      
  L2 Array start offset:  0x00001434
  First Level 3 BMB:  0x00000000
  L2 Hint for inserts:  0x010000a9
  Last Level 1 BMB:  0x010000a8
  Last Level II BMB:  0x010000a9
  Last Level III BMB:  0x00000000
     Map Header:: next  0x00000000  #extents: 1    obj#: 75131  flag: 0x10000000
  Inc # 0 
  Extent Map
  -----------------------------------------------------------------
   0x010000a8  length: 8     
  
  Auxillary Map
  --------------------------------------------------------
   Extent 0     :  L1 dba:  0x010000a8 Data dba:  0x010000ab
  --------------------------------------------------------
  
   Second Level Bitmap block DBAs 
   --------------------------------------------------------
   DBA 1:   0x010000a9
  
End dump data blocks tsn: 4 file#: 4 minblk 170 maxblk 170

2、将Uedit32(通过16进制编辑功能)编辑过的数据文件上传到数据库

13:59:58 SYS@ prod>alter system flush buffer_cache;

System altered.

读取数据出错:

14:00:05 SYS@ prod>select * from scott.emp1;
select * from scott.emp1
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 170)
ORA-01110: data file 4: '/u01/app/oracle/oradata/prod/users01.dbf'

验证数据文件:

[oracle@rh7 ~]$ dbv file=/u01/app/oracle/oradata/prod/users01.dbf blocksize=8192

DBVERIFY: Release 11.2.0.1.0 - Production on Tue Jul 15 13:59:41 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/prod/users01.dbf
Page 170 is marked corrupt
Corrupt block relative dba: 0x010000aa (file 4, block 170)
Bad check value found during dbv: 
Data in bad block:
 type: 35 format: 2 rdba: 0x010000aa
 last change scn: 0x0000.001f891c seq: 0x2 flg: 0x04
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x891c2302
 check value in block header: 0x8eee
 computed block checksum: 0x2020
Page 171 is marked corrupt
Corrupt block relative dba: 0x010000ab (file 4, block 171)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020ab
 last change scn: 0x2020.201f890b seq: 0x2 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x890b0602
 check value in block header: 0xcf8b
 computed block checksum: 0x2e00
Page 172 is marked corrupt
Corrupt block relative dba: 0x010000ac (file 4, block 172)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020ac
 last change scn: 0x2020.201f891c seq: 0x3 flg: 0x06
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x891c0603
 check value in block header: 0xa5b1
 computed block checksum: 0x0
Page 173 is marked corrupt
Corrupt block relative dba: 0x010000ad (file 4, block 173)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020ad
 last change scn: 0x2020.201f891c seq: 0x1 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x891c0601
 check value in block header: 0xf6ab
 computed block checksum: 0x2020
Page 174 is marked corrupt
Corrupt block relative dba: 0x010000ae (file 4, block 174)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020ae
 last change scn: 0x2020.201f891c seq: 0x1 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x891c0601
 check value in block header: 0xcef0
 computed block checksum: 0x20
Page 175 is marked corrupt
Corrupt block relative dba: 0x010000af (file 4, block 175)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020af
 last change scn: 0x2020.201f891c seq: 0x1 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x891c0601
 check value in block header: 0x146a
 computed block checksum: 0x0
Page 176 is marked corrupt
Corrupt block relative dba: 0x010000b0 (file 4, block 176)
Bad header found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x012020b0
 last change scn: 0x2020.201e6219 seq: 0x1 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x62190601
 check value in block header: 0x2185
 computed block checksum: 0x2020

DBVERIFY - Verification complete

Total Pages Examined         : 12800

Total Pages Processed (Data) : 757

Total Pages Failing   (Data) : 0

Total Pages Processed (Index): 2

Total Pages Failing   (Index): 0

Total Pages Processed (Other): 12024

Total Pages Processed (Seg)  : 0

Total Pages Failing   (Seg)  : 0

Total Pages Empty            : 10

Total Pages Marked Corrupt   : 7

Total Pages Influx           : 0

Total Pages Encrypted        : 0

Highest block SCN            : 2066716 (0.2066716)

从以上验证结果看:总共有7个数据块(170-176)被破坏!


3、利用RMAN进行修复

[oracle@rh7 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 15 14:02:16 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD (DBID=239333010)

RMAN> list backup of database;

using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
17      Full    1.13G      DISK        00:01:21     03-JUL-14      
        BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20140703T171545
        Piece Name: /u01/app/oracle/product/11.2.0/db_1/dbs/0lpcfu61_1_1
  List of Datafiles in backup set 17
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/system01.dbf
  2       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/sysaux01.dbf
  3       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/undotbs1.dbf
  4       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/users01.dbf
  5       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/example01.dbf
  6       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/tbs1.dbf
  7       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/undotbs2.dbf
  8       Full 2066885    03-JUL-14 /u01/app/oracle/oradata/prod/perftbs01.dbf


RMAN> blockrecover datafile 4 block 170,171,172,173,174,175,176;

Starting recover at 15-JUL-14
using channel ORA_DISK_1
channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00004
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/db_1/dbs/0lpcfu61_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/db_1/dbs/0lpcfu61_1_1 tag=TAG20140703T171545
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:07
Finished recover at 15-JUL-14

恢复完成,验证:

RMAN> backup validate database;

Starting backup at 15-JUL-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/prod/perftbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/prod/undotbs2.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/prod/tbs1.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/prod/undotbs1.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              13407        99852           2117516   
  File Name: /u01/app/oracle/oradata/prod/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              67302           
  Index      0              15344           
  Other      0              3787            
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    OK     0              17342        66627           2117514   
  File Name: /u01/app/oracle/oradata/prod/sysaux01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              11719           
  Index      0              7882            
  Other      0              29617           
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3    OK     0              1            128             2056342   
  File Name: /u01/app/oracle/oradata/prod/undotbs1.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0               
  Index      0              0               
  Other      0              127             
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              11873        12800           2066716   
  File Name: /u01/app/oracle/oradata/prod/users01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              763             
  Index      0              2               
  Other      0              162             
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
5    OK     0              1680         12804           1715036   
  File Name: /u01/app/oracle/oradata/prod/example01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              3987            
  Index      0              1132            
  Other      0              6001            
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
6    OK     0              2            1281            2051631   
  File Name: /u01/app/oracle/oradata/prod/tbs1.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              1               
  Index      0              0               
  Other      0              1277            
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
7    OK     0              8833         12800           2117516   
  File Name: /u01/app/oracle/oradata/prod/undotbs2.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0               
  Index      0              0               
  Other      0              3967            
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
8    OK     0              23967        25600           2006072   
  File Name: /u01/app/oracle/oradata/prod/perftbs01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              867             
  Index      0              261             
  Other      0              505             
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE       OK     0              2               
Control File OK     0              594             
Finished backup at 15-JUL-14
[oracle@rh7 ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jul 15 14:16:27 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
14:16:27 SYS@ prod>select count(*) from scott.emp1;
  COUNT(*)
----------
        28
Elapsed: 00:00:00.02
14:16:35 SYS@ prod>select * from scott.emp1;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
28 rows selected.
Elapsed: 00:00:00.07

读取数据成功!


[oracle@rh7 ~]$ dbv file=/u01/app/oracle/oradata/prod/users01.dbf blocksize=8192

DBVERIFY: Release 11.2.0.1.0 - Production on Tue Jul 15 14:17:22 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/prod/users01.dbf
DBVERIFY - Verification complete
Total Pages Examined         : 12800
Total Pages Processed (Data) : 763
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 2
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 12025
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 10
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 2066716 (0.2066716)
[oracle@rh7 ~]$

4、查看告警日志信息


告警日志:

dbv校验生成的日志

Reading datafile '/u01/app/oracle/oradata/prod/users01.dbf' for corruption at rdba: 0x010000aa (file 4, block 170)
Reread (file 4, block 170) found same corrupt data
Corrupt Block Found
         TSN = 4, TSNAME = USERS
         RFN = 4, BLK = 170, RDBA = 16777386
         OBJN = -1, OBJD = 75131, OBJECT = USERS, SUBOBJECT = 
         SEGMENT OWNER = , SEGMENT TYPE = Temporary Segment
Tue Jul 15 14:00:25 2014
Trace dumping is performing id=[cdmp_20140715140025]
Tue Jul 15 14:00:25 2014
Errors in file /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_m000_8954.trc  (incident=121488):
ORA-01578: ORACLE data block corrupted (file # 4, block # 170)
ORA-01110: data file 4: '/u01/app/oracle/oradata/prod/users01.dbf'
Hex dump of (file 4, block 176) in trace file /u01/app/oracle/diag/rdbms/prod/prod/incident/incdir_121443/prod_m000_8954_i121443_a.trc
Corrupt block relative dba: 0x010000b0 (file 4, block 176)
Bad header found during validation
Data in bad block:
 type: 6 format: 2 rdba: 0x012020b0
 last change scn: 0x2020.201e6219 seq: 0x1 flg: 0x04
 spare1: 0x20 spare2: 0x20 spare3: 0x2020
 consistency value in tail: 0x62190601
 check value in block header: 0x2185
 computed block checksum: 0x2020
Reread of blocknum=176, file=/u01/app/oracle/oradata/prod/users01.dbf. found same corrupt data
Reread of blocknum=176, file=/u01/app/oracle/oradata/prod/users01.dbf. found same corrupt data
Reread of blocknum=176, file=/u01/app/oracle/oradata/prod/users01.dbf. found same corrupt data
Reread of blocknum=176, file=/u01/app/oracle/oradata/prod/users01.dbf. found same corrupt data
Reread of blocknum=176, file=/u01/app/oracle/oradata/prod/users01.dbf. found same corrupt data
Hex dump of (file 4, block 170) in trace file /u01/app/oracle/diag/rdbms/prod/prod/incident/incdir_121443/prod_m000_8954_i121443_a.trc
Corrupt block relative dba: 0x010000aa (file 4, block 170)
Bad check value found during buffer read
Data in bad block:
 type: 35 format: 2 rdba: 0x010000aa
 last change scn: 0x0000.001f891c seq: 0x2 flg: 0x04
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x891c2302
 check value in block header: 0x8eee
 computed block checksum: 0x2020
Reading datafile '/u01/app/oracle/oradata/prod/users01.dbf' for corruption at rdba: 0x010000aa (file 4, block 170)
Reread (file 4, block 170) found same corrupt data
Corrupt Block Found
         TSN = 4, TSNAME = USERS
         RFN = 4, BLK = 170, RDBA = 16777386
         OBJN = -1, OBJD = 75131, OBJECT = USERS, SUBOBJECT = 
         SEGMENT OWNER = , SEGMENT TYPE = Temporary Segment
Errors in file /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_m000_8954.trc  (incident=121489):
ORA-01578: ORACLE data block corrupted (file # 4, block # 170)
ORA-01110: data file 4: '/u01/app/oracle/oradata/prod/users01.dbf'
Checker run found 7 new persistent data failures
Tue Jul 15 14:01:15 2014
Sweep [inc][121489]: completed
Sweep [inc][121488]: completed
Sweep [inc][121487]: completed
Sweep [inc][121486]: completed
Sweep [inc][121485]: completed
Sweep [inc][121484]: completed
Sweep [inc][121483]: completed
Sweep [inc2][121486]: completed
Sweep [inc2][121485]: completed
Sweep [inc2][121484]: completed
Sweep [inc2][121483]: completed
Sweep [inc2][121443]: completed
Tue Jul 15 14:03:20 2014
alter database recover datafile list clear
Completed: alter database recover datafile list clear

rman recovery的日志:

Started Block Media Recovery
Media Recovery Log /dsk4/arch2/arch_1_17_851265252.log
Recovery of Online Redo Log: Thread 1 Group 3 Seq 18 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo03a.log
  Mem# 1: /dsk2/oradata/prod/redo03b.log
Recovery of Online Redo Log: Thread 1 Group 1 Seq 19 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo01a.log
  Mem# 1: /dsk2/oradata/prod/redo01b.log
Recovery of Online Redo Log: Thread 1 Group 2 Seq 20 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo02a.log
  Mem# 1: /dsk2/oradata/prod/redo02b.log
Completed Block Media Recovery
Tue Jul 15 14:10:26 2014
alter database recover datafile list clear
Completed: alter database recover datafile list clear
Started Block Media Recovery
Media Recovery Log /dsk4/arch2/arch_1_17_851265252.log
Recovery of Online Redo Log: Thread 1 Group 3 Seq 18 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo03a.log
  Mem# 1: /dsk2/oradata/prod/redo03b.log
Recovery of Online Redo Log: Thread 1 Group 1 Seq 19 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo01a.log
  Mem# 1: /dsk2/oradata/prod/redo01b.log
Recovery of Online Redo Log: Thread 1 Group 2 Seq 20 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo02a.log
  Mem# 1: /dsk2/oradata/prod/redo02b.log
Completed Block Media Recovery
Tue Jul 15 14:13:28 2014
alter database recover datafile list clear
Completed: alter database recover datafile list clear
Started Block Media Recovery
Media Recovery Log /dsk4/arch2/arch_1_17_851265252.log
Recovery of Online Redo Log: Thread 1 Group 3 Seq 18 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo03a.log
  Mem# 1: /dsk2/oradata/prod/redo03b.log
Recovery of Online Redo Log: Thread 1 Group 1 Seq 19 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo01a.log
  Mem# 1: /dsk2/oradata/prod/redo01b.log
Recovery of Online Redo Log: Thread 1 Group 2 Seq 20 Reading mem 0
  Mem# 0: /dsk1/oradata/prod/redo02a.log
  Mem# 1: /dsk2/oradata/prod/redo02b.log
Completed Block Media Recovery

@至此,数据块恢复完成!

推荐阅读:
  1. Oracle Rman修复逻辑坏块
  2. Oracle 学习之RMAN(十五)恢复实战--TSPITR

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle rman blockrecover

上一篇:OV SSL证书相比其他证书有什么不同

下一篇:KMS_Office_2010_Plus-Visio-Project激活脚本

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》