<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; oracle文件头损坏恢复</title>
	<atom:link href="https://www.xifenfei.com/tag/oracle%e6%96%87%e4%bb%b6%e5%a4%b4%e6%8d%9f%e5%9d%8f%e6%81%a2%e5%a4%8d/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Sat, 07 Nov 2026 15:45:44 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>分享一例运行在aix上的sap系统数据库恢复过程</title>
		<link>https://www.xifenfei.com/2026/08/sap-oracle-recovery.html</link>
		<comments>https://www.xifenfei.com/2026/08/sap-oracle-recovery.html#comments</comments>
		<pubDate>Fri, 14 Aug 2026 15:49:53 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[Oracle备份恢复]]></category>
		<category><![CDATA[obet bbed]]></category>
		<category><![CDATA[oracle文件头损坏恢复]]></category>
		<category><![CDATA[sap oracle恢复]]></category>
		<category><![CDATA[sap数据库恢复]]></category>
		<category><![CDATA[v7000 lun丢失]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=12294</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2026/08/sap-oracle-recovery.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2026/08/sap-oracle-recovery.html" target="_blank">分享一例运行在aix上的sap系统数据库恢复过程</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p><strong>情况描述</strong><br />
客户sap系统运行在aix系统,ibm v7000存储上,数据存放在三个1T的lun组成的vg的多个lv中.异常断电之后,但是给数据库使用的三个lun丢失了2个,从而使得所有vg/lv异常,通过硬件恢复出来异常的2个lun和剩余的1个lun一起,把所有的数据文件恢复出来.但是由于某种原因,出现部分block被覆盖(其中还包括两个文件头损坏).<br />
<br />
<strong>坏块检测</strong><br />
对于恢复的所有文件,为了快速做一遍坏块检查,直接在恢复的win机器上使用过obet做了一次dbv检查<a href="https://www.xifenfei.com/2026/01/obet-dbv.html" title="obet实现对数据文件坏块检测功能" rel="noopener" target="_blank">obet实现对数据文件坏块检测功能</a>(使用obet的dbv检查有几个好处:1>可以在win上面检测aix的数据文件;2>可以检测数据文件头损坏的数据文件其他block;3>检测速度比原生dbv快[每个文件内部加了并行检测]),检测结果如下</p>
<pre class="brush: bash; title: ; notranslate">
--其中两个文件头损坏
File #62: E:\sr3_54\sr3.data54 (1280000 blocks) - Started: 2026-07-28 23:57:53
File #62: rfile=0 (0x00000000)  header_block_num=0 (0x00000000)  filesize_status:NO
file 62, block 0: block all zero
file 62, block 1: block all zero

File #84: E:\sr3_76\sr3.data76 (4185601 blocks) - Started: 2026-07-29 00:55:32
File #84: rfile=638937491 (0x26156993)  header_block_num=77152556 (0x0499412C)  filesize_status:NO
file 84, block 1: rdba error (expected 1, got 69760), bad block
file 84, block 2: rdba error (expected 2, got 589836), bad block

--坏块汇总
DBV completed at: 2026-07-29 00:58:10
===============================================
DBV Summary:
Total blocks checked: 196287237
Total all zero blocks found: 337417
Total all rdba error blocks found: 1062468
Total all tailchk error blocks found: 1
Total all soft corrupted blocks found: 0
Total all checksum error blocks found: 0
Total bad blocks found: 1399886
Execution time: 10507.00 seconds
===============================================
</pre>
<p>这个统计下来好的block在99.3%左右,证明硬件层面的会效果已经非常好.<br />
<br />
<strong>碎片工具进一步恢复</strong><br />
恢复公司文件系统层面恢复有数据块遗漏的可能,通过碎片工具(<a href="https://www.xifenfei.com/2026/04/orascan.html" title="OraScan(Oracle 碎片扫描工具) 使用说明" rel="noopener" target="_blank">OraScan(Oracle 碎片扫描工具) 使用说明</a>)进一步扫描<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/08/orascan.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/08/orascan.png" alt="orascan" width="1172" height="633" class="alignnone size-full wp-image-12295" /></a><br />
<hr />
通过确认62号文件还有少量block可以进一步恢复（也就是说碎片扫描到的62号文件的block多于硬件公司恢复出来的62号文件里面好的block数量）,通过obet的merge功能进行填补<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/08/obet-merge.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/08/obet-merge.png" alt="obet-merge" width="1535" height="944" class="alignnone size-full wp-image-12296" /></a><br />
<hr />
基于上述操作,对于lun里面的数据文件实现了最大效果恢复.<br />
<br />
<strong>数据库恢复操作</strong><br />
1. 上次恢复文件到aix,offline掉异常文件头数据文件打开数据库</p>
<pre class="brush: sql; title: ; notranslate">
sapprd2:oraprd 8&gt; sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 3 18:41:28 2026

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; select status from v$instance;

STATUS
------------------------------------
STARTED

SQL&gt; alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file '/oracle/PRD/origlogA/cntrl/cntrlPRD.dbf' version
9742943 inconsistent with file '/oracle/PRD/sapdata1/cntrl/cntrlPRD.dbf'
version 9742931
</pre>
<p>解决ctl不一致问题之后继续mount库恢复</p>
<pre class="brush: sql; title: ; notranslate">
sapprd2:oraprd 11&gt; sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 3 18:42:53 2026

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; alter database mount;

Database altered.

SQL&gt; alter database datafile 62,84 offline;

Database altered.

SQL&gt; recover database ;
Media recovery complete.
SQL&gt; alter database open;

Database altered.
</pre>
<p>2.对于两个损坏的数据文件头进行修复<br />
由于现在aix环境的客户比较少,obet没有在aix环境下进行编译,因此直接使用bbed工具进行文件头修复（列举了主要操作过程）</p>
<pre class="brush: bash; title: ; notranslate">
BBED&gt; copy file 83 block 1 to file 84 block 1
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:    0 to   31           Dba:0x15000001
------------------------------------------------------------------------
 0ba20000 14c00001 00000000 00000104 22250000 00000000 0b200000 72bc991d

 &lt;32 bytes per line&gt;

BBED&gt; set offset 368
        OFFSET          368

BBED&gt; d
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:  368 to  399           Dba:0x15000001
------------------------------------------------------------------------
 00000053 00000000 00000000 495dc097 00000000 00000000 00000000 00000000

 &lt;32 bytes per line&gt;

BBED&gt; m /x 00000054
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:  368 to  399           Dba:0x15000001
------------------------------------------------------------------------
 00000054 00000000 00000000 495dc097 00000000 00000000 00000000 00000000

 &lt;32 bytes per line&gt;

BBED&gt; set offset 52
        OFFSET          52

BBED&gt; d
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:   52 to   83           Dba:0x15000001
------------------------------------------------------------------------
 00530003 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 &lt;32 bytes per line&gt;

BBED&gt; m /x 0054
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:   52 to   83           Dba:0x15000001
------------------------------------------------------------------------
 00540003 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 &lt;32 bytes per line&gt;

BBED&gt; set offset 4
        OFFSET          4

BBED&gt; d
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:    4 to   35           Dba:0x15000001
------------------------------------------------------------------------
 14c00001 00000000 00000104 22250000 00000000 0b200000 72bc991d 50524400

 &lt;32 bytes per line&gt;

BBED&gt; m /x 15000001
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:    4 to   35           Dba:0x15000001
------------------------------------------------------------------------
 15000001 00000000 00000104 22250000 00000000 0b200000 72bc991d 50524400

 &lt;32 bytes per line&gt;


BBED&gt; m /x E1B0
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:  100 to  611           Dba:0x15000001
------------------------------------------------------------------------
 e1b0853f 00040000 4083fcfe 33606b63 02502452 0000ca28 49680fb3 93b9f6b9

 &lt;32 bytes per line&gt;

BBED&gt; set offset +2
        OFFSET          102

BBED&gt; m /x 8542
 File: /oracle/PRD/sapdata3/sr3_76/sr3.data76 (84)
 Block: 1                Offsets:  102 to  613           Dba:0x15000001
------------------------------------------------------------------------
 85420004 00004083 fcfe3360 6b630250 24520000 ca284968 0fb393b9 f6b90005

 &lt;32 bytes per line&gt;


BBED&gt; sum
Check value for File 84, Block 1:
current = 0x2225, required = 0x23e5

BBED&gt; sum apply
Check value for File 84, Block 1:
current = 0x23e5, required = 0x23e5

BBED&gt; verify
DBVERIFY - Verification starting
FILE = /oracle/PRD/sapdata3/sr3_76/sr3.data76
BLOCK = 1


DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED
</pre>
<p>修改完成之后,还出现过几个错误</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter database open ;
alter database open
*
ERROR at line 1:
ORA-01122: database file 62 failed verification check
ORA-01110: data file 62: '/oracle/PRD/sapdata2/sr3_54/sr3.data54'
ORA-01200: actual file size of 1279999 is smaller than correct size of 1280000
</pre>
<p>ORA-01200是由于数据文件比文件头记录信息小一个block,通过补上这个block解决</p>
<pre class="brush: bash; title: ; notranslate">
Read of datafile '/oracle/PRD/sapdata2/sr3_54/sr3.data54' (fno 62) header failed with ORA-01202
Rereading datafile 62 header failed with ORA-01202
Errors in file /oracle/PRD/saptrace/diag/rdbms/prd/PRD/trace/PRD_ora_11272278.trc:
ORA-01122: database file 62 failed verification check
ORA-01110: data file 62: '/oracle/PRD/sapdata2/sr3_54/sr3.data54'
ORA-01202: wrong incarnation of this file - wrong creation time
</pre>
<p>ORA-01202是由于create time没有修改正确导致,重新修改解决</p>
<pre class="brush: bash; title: ; notranslate">
Rereading datafile 84 header failed with ORA-01203
Errors in file /oracle/PRD/saptrace/diag/rdbms/prd/PRD/trace/PRD_ora_17105252.trc:
ORA-01122: database file 84 failed verification check
ORA-01110: data file 84: '/oracle/PRD/sapdata3/sr3_76/sr3.data76'
ORA-01203: wrong incarnation of this file - wrong creation SCN
</pre>
<p>ORA-01203是由于create scn没有修改正确导致,重新修改解决</p>
<pre class="brush: bash; title: ; notranslate">
Errors in file /oracle/PRD/saptrace/diag/rdbms/prd/PRD/trace/PRD_ora_17105278.trc:
ORA-01122: database file 62 failed verification check
ORA-01110: data file 62: '/oracle/PRD/sapdata2/sr3_54/sr3.data54'
ORA-01207: file is more recent than control file - old control file
ORA-1122 signalled during: alter database open .
</pre>
<p>ORA-01207是由于数据文件的ckp信息比控制文件的新,重建ctl解决,解决这些问题之后,顺利打开数据库</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 3.7548E+10 bytes
Fixed Size                  2254136 bytes
Variable Size            1.9193E+10 bytes
Database Buffers         1.8254E+10 bytes
Redo Buffers               98996224 bytes
Database mounted.
SQL&gt; alter database open;

Database altered.

SQL&gt; select status,count(1) from v$datafile_header group by status;

STATUS    COUNT(1)
------- ----------
ONLINE          84
</pre>
<p>然后跳过坏块,导出数据,对于无法导出的异常表进行特殊处理,完成本次恢复工作,最终恢复结果总结<br />
<a href="https://www.xifenfei.com/wp-content/uploads/2026/08/all.png"><img src="https://www.xifenfei.com/wp-content/uploads/2026/08/all.png" alt="all" width="739" height="334" class="alignnone size-full wp-image-12297" /></a><br />
<hr />
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/01/dd%e6%93%8d%e4%bd%9c%e6%95%b0%e6%8d%ae%e6%96%87%e4%bb%b6.html" rel="bookmark" class="crp_title">dd操作数据文件</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/05/bbed%e5%a4%84%e7%90%86ora-01200%e6%95%85%e9%9a%9c.html" rel="bookmark" class="crp_title">bbed处理ORA-01200故障</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/12/%e5%9c%a8ultraedit%e4%b8%ad%e5%ae%9a%e4%bd%8d%e6%95%b0%e6%8d%ae%e6%96%87%e4%bb%b6%e5%86%85%e5%ae%b9.html" rel="bookmark" class="crp_title">在UltraEdit中定位数据文件内容</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2016/03/bbed-recovery-corrupted-block.html" rel="bookmark" class="crp_title">file 1 block 128 corrupted/坏块恢复&#8212;system rollback坏块修复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/bbed-%e5%88%a0%e9%99%a4-cluster-table-%e8%ae%b0%e5%bd%95.html" rel="bookmark" class="crp_title">bbed 删除 cluster table 记录</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/%e5%88%a9%e7%94%a8bbed%e6%89%be%e5%9b%9ebbed%e6%9b%b4%e6%96%b0%e5%89%8d%e5%80%bc.html" rel="bookmark" class="crp_title">利用bbed找回ORACLE更新前值</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/05/%e7%b3%bb%e7%bb%9f%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%96%87%e4%bb%b6%e7%ac%ac%e4%b8%80%e4%b8%aa%e6%95%b0%e6%8d%ae%e5%9d%97%e5%92%8coracle-%e4%b8%ad%e7%ac%ac%e4%b8%80%e4%b8%aa%e6%95%b0%e6%8d%ae%e5%9d%97.html" rel="bookmark" class="crp_title">系统中数据文件第一个数据块和oracle 中第一个数据块关系</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/09/%e6%a8%a1%e6%8b%9f%e6%99%ae%e9%80%9aora-08103%e5%b9%b6%e8%a7%a3%e5%86%b3.html" rel="bookmark" class="crp_title">模拟普通ORA-08103并解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2023/09/bbed-ora-1578.html" rel="bookmark" class="crp_title">bbed解决ORA-01578</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/08/ora-600-krhpfh_03-1210.html" rel="bookmark" class="crp_title">ORA-600 krhpfh_03-1210故障处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/09/ora-01122-ora-01210-%e6%95%85%e9%9a%9c%e6%81%a2%e5%a4%8d.html" rel="bookmark" class="crp_title">ORA-01122 ORA-01210 故障恢复</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/05/%e4%bd%bf%e7%94%a8bbed%e4%bf%ae%e5%a4%8d%e6%8d%9f%e5%9d%8fdatafile-header.html" rel="bookmark" class="crp_title">使用bbed修复损坏datafile header</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2026/08/sap-oracle-recovery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
