Oracle RMAN修复逻辑坏块
试用Rman可以实现数据块级的数据恢复,在传统恢复手段中即某个数据文件的一个数据块被损坏,就造成整个数据文件无法试用,此时必
RMAN 实现数据块恢复
试用Rman可以实现数据块级的数据恢复,在传统恢复手段中即某个数据文件的一个数据块被损坏,就造成整个数据文件无法试用,此时必须通过备份恢复整个数据文件。显然这样的方法会会时间较长,而RMAN实现块级恢复,如果某个数据文件的数据损坏,通过数据文件的完整备份就可以恢复数据块。
案例:
数据库是一个单实例Oracle数据库,该库的总大小有700G。
存储设备使用华为存储,备份设备使用希捷3T的移动硬盘。该数据库无DG无OGG。备份策略为每周六0点全库备份,周三0点1级差异备份其余时间为每天0点做2级差异备份。全库备份大小为500G左右。
2.2 故障情况
本次故障原因是INSPUROA用户在查询EDOC_BASE_WORKFLOW表出现报错。提示故障坏块为datafile 5。报错信息取至alter日志如下:
Reading datafile '/oradata/datafiles/oadb/oa01.dbf' for corruption at rdba: 0x016d4dd5 (file 5, block 2969045)
Reread (file 5, block 2969045) found same corrupt data (no logical check)
Tue Aug 18 10:53:51 2015
Corrupt Block Found
TSN = 6, TSNAME = OA
RFN = 5, BLK = 2969045, RDBA = 23940565
OBJN = 95690, OBJD = 95690, OBJECT = EDOC_BASE_WORKFLOW, SUBOBJECT =
SEGMENT OWNER = INSPUROA, SEGMENT TYPE = Table Segment
Tue Aug 18 10:55:03 2015
Hex dump of (file 5, block 2969045) in trace file /u01/app/oracle/diag/rdbms/oadb/oadb/trace/oadb_ora_4565.trc
Corrupt block relative dba: 0x016d4dd5 (file 5, block 2969045)
Bad header found during buffer read
Data in bad block:
type: 117 format: 0 rdba: 0x20206b73
last change scn: 0x2020.20202020 seq: 0x20 flg: 0x20
spare1: 0x64 spare2: 0x69 spare3: 0x0
consistency value in tail: 0x4d240601
check value in block header: 0x5f49
block checksum disabled
Reading datafile '/oradata/datafiles/oadb/oa01.dbf' for corruption at rdba: 0x016d4dd5 (file 5, block 2969045)
Reread (file 5, block 2969045) found same corrupt data (no logical check)
Tue Aug 18 10:55:03 2015
Corrupt Block Found
TSN = 6, TSNAME = OA
RFN = 5, BLK = 2969045, RDBA = 23940565
OBJN = 95690, OBJD = 95690, OBJECT = EDOC_BASE_WORKFLOW, SUBOBJECT =
SEGMENT OWNER = INSPUROA, SEGMENT TYPE = Table Segment
Tue Aug 18 10:57:29 2015
Hex dump of (file 5, block 2969045) in trace file /u01/app/oracle/diag/rdbms/oadb/oadb/trace/oadb_ora_21708.trc
Corrupt block relative dba: 0x016d4dd5 (file 5, block 2969045)
Bad header found during buffer read
Data in bad block:
type: 117 format: 0 rdba: 0x20206b73
last change scn: 0x2020.20202020 seq: 0x20 flg: 0x20
spare1: 0x64 spare2: 0x69 spare3: 0x0
consistency value in tail: 0x4d240601
check value in block header: 0x5f49
block checksum disabled
分析原因
观察存储,无报错警告,初步怀疑逻辑坏块
执行修复
根据报错信息
Reading datafile '/oradata/datafiles/oadb/oa01.dbf' for corruption at rdba: 0x016d4dd5 (file 5, block 2969045)
Reread (file 5, block 2969045) found same corrupt data (no logical check)
Corrupt Block Found
TSN = 6, TSNAME = OA
RFN = 5, BLK = 2969045, RDBA = 23940565
OBJN = 95690, OBJD = 95690, OBJECT = EDOC_BASE_WORKFLOW, SUBOBJECT =
SEGMENT OWNER = INSPUROA, SEGMENT TYPE = Table Segment
确定数据文件 datafile 5,oa01.dbf出现坏块现象
查看坏块信息:
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
5 2969045 1 0 CORRUPT
确定坏块为2969045号
检查备份日志(增量,全量)是否完整备份
检查备份datafile 5 是否完整
RMAN> backup validate datafile 5;
Starting backup at 18-AUG-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=982 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/oradata/datafiles/oadb/oa01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:35
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
5 FAILED 0 1840 4190720 9484751217293
File Name: /oradata/datafiles/oadb/oa01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 2842014
Index 0 182983
Other 1 1163883
validate found one or more corrupt blocks
See trace file /u01/app/oracle/diag/rdbms/oadb/oadb/trace/oadb_ora_13513.trc for details
Finished backup at 18-AUG-15
执行修复
使用RMAN工具
RMAN> blockrecover datafile 5 block 2969045;
Starting recover at 18-AUG-15
using channel ORA_DISK_1

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]
