标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,885)
- DB2 (22)
- MySQL (82)
- Oracle (1,710)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (73)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (663)
- Oracle安装升级 (108)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (52)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (35)
- MongoDB (1)
-
最近发表
- rmanext:从损坏的 Oracle RMAN 备份中强制提取数据文件
- 恢复案例分享:win丢失数据文件恢复
- 记录19c ASM磁盘掉线触发ORA-59048故障处理
- aix平台Oracle数据库由于断电无法启动故障处理
- 断电引起ORA-600 3005故障处理
- 记录一次云存储资源到期之后引起的数据库恢复
- Firebird 损坏数据库数据抢救工具—firebirdext
- Oracle 19c 202610补丁(RUs+OJVM)-19.33
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
标签归档:bbed
bbed修改undo$(回滚段)状态
指定undo$对应数据块(11g 1_225,10g 1_106)[具体时候需要查询]
BBED> set file 1 block 225
FILE# 1
BLOCK# 225
查询数据内容,主要关注kdbr
BBED> map File: /u01/oracle/oradata/ora11g/system01.dbf (1) Block: 225 Dba:0x004000e1 ------------------------------------------------------------ KTB Data Block (Table/Cluster) struct kcbh, 20 bytes @0 struct ktbbh, 48 bytes @20 struct kdbh, 14 bytes @68 struct kdbt[1], 4 bytes @82 sb2 kdbr[31] @86 <===表示31条记录,从0开始 ub1 freespace[3644] @148 ub1 rowdata[4396] @3792 ub4 tailchk @8188
查看30号回滚段内容(列举其中一个)
BBED> p *kdbr[30] rowdata[0] ---------- ub1 rowdata[0] @3792 0x2c BBED> x /rncnnnnnnn rowdata[0] @3792 ---------- flag@3792: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@3793: 0x01 cols@3794: 17 col 0[2] @3795: 30 col 1[21] @3798: _SYSSMU30_3379578723$ col 2[2] @3820: 1 col 3[2] @3823: 3 col 4[3] @3826: 432 col 5[1] @3830: 0 col 6[1] @3832: 0 col 7[1] @3834: 0 col 8[1] @3836: 0 col 9[1] @3838: 0 col 10[2] @3840: 5 <===修改前对应值undo$.status$ col 11[2] @3843: 6 col 12[0] @3846: *NULL* col 13[0] @3847: *NULL* col 14[0] @3848: *NULL* col 15[0] @3849: *NULL* col 16[2] @3850: 2 BBED> x /r rowdata[0] @3792 ---------- flag@3792: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@3793: 0x01 cols@3794: 17 col 0[2] @3795: 0xc1 0x1f col 1[21] @3798: 0x5f 0x53 0x59 0x53 0x53 0x4d 0x55 0x33 0x30 0x5f 0x33 0x33 0x37 0x39 0x35 0x37 0x38 0x37 0x32 0x33 0x24 col 2[2] @3820: 0xc1 0x02 col 3[2] @3823: 0xc1 0x04 col 4[3] @3826: 0xc2 0x05 0x21 col 5[1] @3830: 0x80 col 6[1] @3832: 0x80 col 7[1] @3834: 0x80 col 8[1] @3836: 0x80 col 9[1] @3838: 0x80 col 10[2] @3840: 0xc1 0x06 <===修改前16进制值 col 11[2] @3843: 0xc1 0x07 col 12[0] @3846: *NULL* col 13[0] @3847: *NULL* col 14[0] @3848: *NULL* col 15[0] @3849: *NULL* col 16[2] @3850: 0xc1 0x03
修改回滚段状态
BBED> m /x 02 offset 3842 <===注意修改为02 Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /u01/oracle/oradata/ora11g/system01.dbf (1) Block: 225 Offsets: 3842 to 4353 Dba:0x004000e1 ------------------------------------------------------------------------ 0202c107 ffffffff 02c1032c 001102c1 <32 bytes per line> BBED> p *kdbr[30] rowdata[0] ---------- ub1 rowdata[0] @3792 0x2c BBED> x /r rowdata[0] @3792 ---------- flag@3792: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@3793: 0x01 cols@3794: 17 col 0[2] @3795: 0xc1 0x1f col 1[21] @3798: 0x5f 0x53 0x59 0x53 0x53 0x4d 0x55 0x33 0x30 0x5f 0x33 0x33 0x37 0x39 0x35 0x37 0x38 0x37 0x32 0x33 0x24 col 2[2] @3820: 0xc1 0x02 col 3[2] @3823: 0xc1 0x04 col 4[3] @3826: 0xc2 0x05 0x21 col 5[1] @3830: 0x80 col 6[1] @3832: 0x80 col 7[1] @3834: 0x80 col 8[1] @3836: 0x80 col 9[1] @3838: 0x80 col 10[2] @3840: 0xc1 0x02 <===修改后16进制值 col 11[2] @3843: 0xc1 0x07 col 12[0] @3846: *NULL* col 13[0] @3847: *NULL* col 14[0] @3848: *NULL* col 15[0] @3849: *NULL* col 16[2] @3850: 0xc1 0x03 BBED> x /rncnnnnnnn rowdata[0] @3792 ---------- flag@3792: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@3793: 0x01 cols@3794: 17 col 0[2] @3795: 30 col 1[21] @3798: _SYSSMU30_3379578723$ col 2[2] @3820: 1 col 3[2] @3823: 3 col 4[3] @3826: 432 col 5[1] @3830: 0 col 6[1] @3832: 0 col 7[1] @3834: 0 col 8[1] @3836: 0 col 9[1] @3838: 0 col 10[2] @3840: 1 <===实际展示值undo$.status$ col 11[2] @3843: 6 col 12[0] @3846: *NULL* col 13[0] @3847: *NULL* col 14[0] @3848: *NULL* col 15[0] @3849: *NULL* col 16[2] @3850: 2
1.修改为02(表示的实际值比修改值大1[1:DELETE,2:OFFLINE, 3:ONLINE,4:UNDEFINED,5:NEEDS RECOVERY,6:PARTLY AVAILABLE,其他表示:UNDEFINED])
2.Offset需要在10列漂移量上+2(或者11列偏移量-1)
修改验证值
BBED> sum apply Check value for File 1, Block 225: current = 0x9708, required = 0x9708
补充说明
1)通过dbms_metadata.get_ddl分析DBA_ROLLBACK_SEGS可以知道seg$.status$表示含义
2, 'OFFLINE' 3, 'ONLINE', 4, 'UNDEFINED' 5, 'NEEDS RECOVERY', 6, 'PARTLY AVAILABLE' other, 'UNDEFINED'
2)该方法一般出现在使用隐含参数屏蔽回滚段无效之后使用,一般不到最后,不建议使用该方法,可能引起不可预知的后果
3)使用该方法启动数据库后,需要手工删除seg$中被bbed处理过的回滚段
使用bbed让rac中的sysaux数据文件online
一个朋友的11g rac库的sysaux表空间因某种原因缺少历史归档,导致无法正常online,是的数据库的很多功能受限.通过实现展示恢复过程.
模拟环境
SQL> select name,file#,status from v$datafile; NAME FILE# STATUS ---------------------------------------------------- ---------- ------- +XIFENFEI/xff/datafile/system.256.776961315 1 SYSTEM +XIFENFEI/xff/datafile/sysaux.257.776961315 2 ONLINE +XIFENFEI/xff/datafile/undotbs1.258.776961317 3 ONLINE +XIFENFEI/xff/datafile/user_dd.dbf 4 ONLINE +XIFENFEI/xff/datafile/undotbs2.264.776961693 5 ONLINE +XIFENFEI/asm/datafile/xifenfei01.dbf.268.781967893 6 ONLINE 6 rows selected. SQL> alter database datafile 2 offline; Database altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 14 Next log sequence to archive 15 Current log sequence 15 SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> / System altered. SQL> / System altered. SQL> / System altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 19 Next log sequence to archive 19 Current log sequence 20 --删除部分归档日志 [grid@rac1 ~]$ asmcmd ASMCMD> ls DATA/ XIFENFEI/ ASMCMD> cd data ASMCMD> ls XFF/ rac-cluster/ ASMCMD> cd xff ASMCMD> ls ARCHIVELOG/ CONTROLFILE/ ONLINELOG/ ASMCMD> cd archivelog ASMCMD> ls 2012_03_03/ 2012_04_13/ 2012_04_30/ 2012_05_01/ 2012_05_24/ 2012_06_12/ ASMCMD> cd 2012_06_12 ASMCMD> ls thread_1_seq_15.280.785752747 thread_1_seq_16.281.785752845 thread_1_seq_17.282.785752929 thread_1_seq_18.283.785753043 thread_1_seq_19.284.785753115 ASMCMD> rm thread_1_seq_16.281.785752845 ASMCMD> rm thread_1_seq_15.280.785752747
尝试online 数据文件
SQL> alter database datafile 2 online;
alter database datafile 2 online
*
ERROR at line 1:
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: '+XIFENFEI/xff/datafile/sysaux.257.776961315'
SQL> recover datafile 2;
ORA-00279: change 1155352 generated at 06/12/2012 08:20:10 needed for thread 1
ORA-00289: suggestion :
+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747
ORA-00280: change 1155352 for thread 1 is in sequence #15
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747
ORA-15012: ASM file
'+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747' does not exist
ORA-00308: cannot open archived log
'+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747
ORA-15012: ASM file
'+DATA/xff/archivelog/2012_06_12/thread_1_seq_15.280.785752747' does not exist
准备bbed修改数据文件
现在datafile 2不能恢复,我们需要修改的就是该datafile header 相关的scn等信息,另外拷贝一个数据文件出来做修改时候参考
RMAN> copy datafile 2 to '/tmp/auxsys.dbf_rman'; Starting backup at 2012-06-12 08:59:07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=20 instance=XFF1 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=+XIFENFEI/xff/datafile/sysaux.257.776961315 output file name=/tmp/auxsys.dbf_rman tag=TAG20120612T090029 RECID=1 STAMP=785754322 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:50 Finished backup at 2012-06-12 09:05:36 RMAN> copy datafile 4 to '/tmp/user.dbf_rman'; Starting backup at 2012-06-12 09:09:28 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=+XIFENFEI/xff/datafile/user_dd.dbf output file name=/tmp/user.dbf_rman tag=TAG20120612T090932 RECID=2 STAMP=785754582 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 Finished backup at 2012-06-12 09:09:48
bbed修改datafile header
[oracle@rac1 tmp]$ bbed password=blockedit listfile=/tmp/o_bbed mode=edit
BBED: Release 2.0.0.0.0 - Limited Production on Tue Jun 12 09:37:30 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /tmp/auxsys.dbf_rman 0
2 /tmp/user.dbf_rman 0
BBED> set file 2 block 1
FILE# 2
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0011a787
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2ed5a9cd
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000014
ub4 kcrbabno @504 0x000000c5
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> p kcvfhcpc
ub4 kcvfhcpc @140 0x00000086
BBED> p kcvfhccc
ub4 kcvfhccc @148 0x00000085
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0011a118
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2ed59e3a
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000000f
ub4 kcrbabno @504 0x0000c4ed
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> p kcvfhcpc
ub4 kcvfhcpc @140 0x00000079
BBED> p kcvfhccc
ub4 kcvfhccc @148 0x00000078
/*
确定需要修改项kscnbas/kcvcptim/kcvfhcpc/kcvfhccc的相关信息
*/
BBED> set count 16
COUNT 16
BBED> d file 2 block 1 offset 484
File: /tmp/user.dbf_rman (2)
Block: 1 Offsets: 484 to 499 Dba:0x00800001
------------------------------------------------------------------------
87a71100 00001000 cda9d52e 01000000
<32 bytes per line>
BBED> m /x 87a71100 file 1 block 1 offset 484
BBED-00209: invalid number (87a71100)
BBED> m /x 87a7 file 1 block 1 offset 484
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 484 to 499 Dba:0x00400001
------------------------------------------------------------------------
87a71100 00000000 3a9ed52e 01000000
<32 bytes per line>
BBED> d file 2 block 1 offset 492
File: /tmp/user.dbf_rman (2)
Block: 1 Offsets: 492 to 507 Dba:0x00800001
------------------------------------------------------------------------
cda9d52e 01000000 14000000 c5000000
<32 bytes per line>
BBED> m /x cda9d52e file 1 block 1 offset 492
BBED-00209: invalid number (cda9d52e)
BBED> d file 1 block 1 offset 492
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 492 to 507 Dba:0x00400001
------------------------------------------------------------------------
3a9ed52e 01000000 0f000000 edc40000
<32 bytes per line>
BBED> m /x cda9 file 1 block 1 offset 492
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 492 to 507 Dba:0x00400001
------------------------------------------------------------------------
cda9d52e 01000000 0f000000 edc40000
<32 bytes per line>
BBED> d file 1 block 1 offset 140
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 140 to 155 Dba:0x00400001
------------------------------------------------------------------------
79000000 2970bc2e 78000000 00000000
<32 bytes per line>
BBED> d file 2 block 1 offset 140
File: /tmp/user.dbf_rman (2)
Block: 1 Offsets: 140 to 155 Dba:0x00800001
------------------------------------------------------------------------
86000000 2970bc2e 85000000 00000000
<32 bytes per line>
BBED> m /x 86000000 file 1 block 1 offset 140
BBED-00209: invalid number (86000000)
BBED> m /x 8600 file 1 block 1 offset 140
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 140 to 155 Dba:0x00400001
------------------------------------------------------------------------
86000000 2970bc2e 78000000 00000000
<32 bytes per line>
BBED> d file 2 block 1 offset 148
File: /tmp/user.dbf_rman (2)
Block: 1 Offsets: 148 to 163 Dba:0x00800001
------------------------------------------------------------------------
85000000 00000000 00000000 00000000
<32 bytes per line>
BBED> m /x 8500 file 1 block 1 offset 148
File: /tmp/auxsys.dbf_rman (1)
Block: 1 Offsets: 148 to 163 Dba:0x00400001
------------------------------------------------------------------------
85000000 00000000 00000000 00000000
<32 bytes per line>
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0011a787
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2ed5a9cd
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000000f
ub4 kcrbabno @504 0x0000c4ed
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> p kcvfhcpc
ub4 kcvfhcpc @140 0x00000086
BBED> p kcvfhccc
ub4 kcvfhccc @148 0x00000085
BBED> sum apply
Check value for File 1, Block 1:
current = 0x48c4, required = 0x48c4
使用修改后数据文件尝试online
SQL> alter database rename file '+XIFENFEI/xff/datafile/sysaux.257.776961315' to '/tmp/auxsys.dbf_rman'; Database altered. SQL> recover database datafile 2 ; ORA-00274: illegal recovery option DATAFILE SQL> recover database datafile 2; ORA-00274: illegal recovery option DATAFILE SQL> recover datafile 2; ORA-00283: recovery session canceled due to errors ORA-01122: database file 2 failed verification check ORA-01110: data file 2: '/tmp/auxsys.dbf_rman' ORA-01207: file is more recent than control file - old control file
尝试重建控制文件
SQL> alter database backup controlfile to trace as '/tmp/xifenfei.ctl'; Database altered. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> STARTUP NOMOUNT ORACLE instance started. Total System Global Area 535662592 bytes Fixed Size 1346140 bytes Variable Size 411043236 bytes Database Buffers 117440512 bytes Redo Buffers 5832704 bytes SQL> @xifenfei_ctl CREATE CONTROLFILE REUSE DATABASE "XFF" NORESETLOGS ARCHIVELOG * ERROR at line 1: ORA-01503: CREATE CONTROLFILE failed ORA-12720: operation requires database is in EXCLUSIVE mode --在rac中重建控制文件需要设置cluster_database=FALSE SQL> alter system set cluster_database=FALSE scope=spfile; System altered. SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> STARTUP NOMOUNT ORACLE instance started. Total System Global Area 535662592 bytes Fixed Size 1346140 bytes Variable Size 411043236 bytes Database Buffers 117440512 bytes Redo Buffers 5832704 bytes SQL> @xifenfei_ctl Control file created.
online数据文件
重建控制文件恢复数据库之后 datafile 2自动online成功,省去了手工处理麻烦,如果没有自动online,请手工处理
SQL> recover database; Media recovery complete. SQL> alter database open; Database altered. SQL> col name for a52 SQL> select name,file#,status from v$datafile; NAME FILE# STATUS ---------------------------------------------------- ---------- ------- +XIFENFEI/xff/datafile/system.256.776961315 1 SYSTEM /tmp/auxsys.dbf_rman 2 ONLINE +XIFENFEI/xff/datafile/undotbs1.258.776961317 3 ONLINE +XIFENFEI/xff/datafile/user_dd.dbf 4 ONLINE +XIFENFEI/xff/datafile/undotbs2.264.776961693 5 ONLINE +XIFENFEI/asm/datafile/xifenfei01.dbf.268.781967893 6 ONLINE 6 rows selected.
文件系统中的datafile 2 恢复到asm中
SQL> alter database datafile 2 offline; Database altered. RMAN> copy datafile 2 to '+XIFENFEI'; Starting backup at 2012-06-12 10:55:42 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=21 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=/tmp/auxsys.dbf_rman output file name=+XIFENFEI/xff/datafile/sysaux.257.785761227 tag=TAG20120612T105800 RECID=1 STAMP=785762097 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:16:24 Finished backup at 2012-06-12 11:15:05 RMAN> switch datafile 2 to copy; datafile 2 switched to datafile copy "+XIFENFEI/xff/datafile/sysaux.257.785761227" RMAN> recover datafile 2; Starting recover at 2012-06-12 11:30:32 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:01:30 Finished recover at 2012-06-12 11:34:11 RMAN> sql 'alter database datafile 2 online'; sql statement: alter database datafile 2 online
验证和收尾工作
SQL> select name,file#,status from v$datafile; NAME FILE# STATUS ---------------------------------------------------- ---------- ------- +XIFENFEI/xff/datafile/system.256.776961315 1 SYSTEM +XIFENFEI/xff/datafile/sysaux.257.785761227 2 ONLINE +XIFENFEI/xff/datafile/undotbs1.258.776961317 3 ONLINE +XIFENFEI/xff/datafile/user_dd.dbf 4 ONLINE +XIFENFEI/xff/datafile/undotbs2.264.776961693 5 ONLINE +XIFENFEI/asm/datafile/xifenfei01.dbf.268.781967893 6 ONLINE SQL> alter system set cluster_database=true scope=spfile; System altered. --然后重启节点
使用Oracle Recovery Tools一键式解决给问题
使用bbed修复损坏datafile header
对于此类oracle的block编辑工作,可以通过自研的图形化小工具Oracle Recovery Tools工具快速修改
软件下载:OraRecovery下载
使用说明:使用说明
相关信息和准备工作
SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production PL/SQL Release 9.2.0.4.0 - Production CORE 9.2.0.3.0 Production TNS for Linux: Version 9.2.0.4.0 - Production NLSRTL Version 9.2.0.4.0 - Production SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') "www.xifenfei.com" from dual; www.xifenfei.com ------------------- 2012-05-29 19:39:48
启动数据块异常
SQL> startup ORACLE instance started. Total System Global Area 353441008 bytes Fixed Size 451824 bytes Variable Size 184549376 bytes Database Buffers 167772160 bytes Redo Buffers 667648 bytes Database mounted. ORA-01110: data file 11: '/u01/oracle/oradata/xifenfei/bbed01.dbf' ORA-01115: IO error reading block from file 11 (block # 1) ORA-27072: skgfdisp: I/O error
bbed检测datafile header
[oracle@xifenfei ~]$ bbed password=blockedit blocksize=8192 listfile=/home/oracle/bbed.file mode=edit
BBED: Release 2.0.0.0.0 - Limited Production on Sat May 26 05:29:37 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /home/oracle/users01.dbf 0
2 /home/oracle/system01.dbf.head 0
3 /home/oracle/data11.ora 0
4 /u01/oracle/oradata/xifenfei/system01.dbf 0
5 /u01/oracle/oradata/xifenfei/users01.dbf 0
6 /home/oracle/data11.ora.10 0
11 /u01/oracle/oradata/xifenfei/bbed01.dbf 0
12 /u01/oracle/oradata/xifenfei/bbed02.dbf 0
BBED> set file 11
FILE# 11
BBED> set block 1
BLOCK# 1
BBED> map
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Dba:0x02c00001
------------------------------------------------------------
BBED-00400: invalid blocktype (00)
BBED> d
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 0 to 511 Dba:0x02c00001
------------------------------------------------------------------------
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
--header 记录全部为0,证明数据文件header坏掉
拷贝数据块
为了方便,拷贝同一个表空间的数据块
BBED> set file 12
FILE# 12
BBED> set block 1
BLOCK# 1
BBED> d count 16
File: /u01/oracle/oradata/xifenfei/bbed02.dbf (12)
Block: 1 Offsets: 0 to 15 Dba:0x03000001
------------------------------------------------------------------------
0b020000 01000003 00000000 00000104
<32 bytes per line>
BBED> copy dba 0x03000001 to dba 0x02c00001
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 0 to 15 Dba:0x02c00001
------------------------------------------------------------------------
0b020000 01000003 00000000 00000104
<32 bytes per line>
BBED> show
FILE# 11
BLOCK# 1
OFFSET 0
DBA 0x02c00001 (46137345 11,1)
FILENAME /u01/oracle/oradata/xifenfei/bbed01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/bbed.file
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 16
LOGFILE log.bbd
SPOOL No
BBED> map
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Dba:0x02c00001
------------------------------------------------------------
Data File Header
struct kcvfh, 360 bytes @0
ub4 tailchk @8188
修改数据块内容
BBED> p kcvfh
struct kcvfh, 360 bytes @0
struct kcvfhbfh, 20 bytes @0
ub1 type_kcbh @0 0x0b
ub1 frmt_kcbh @1 0x02
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x03000001
ub4 bas_kcbh @8 0x00000000
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xb10a
ub2 spare3_kcbh @18 0x0000
struct kcvfhhdr, 76 bytes @20
ub4 kccfhswv @20 0x09200000
ub4 kccfhcvn @24 0x08000000
ub4 kccfhdbi @28 0x5314b4cd
text kccfhdbn[0] @32 X
text kccfhdbn[1] @33 I
text kccfhdbn[2] @34 F
text kccfhdbn[3] @35 E
text kccfhdbn[4] @36 N
text kccfhdbn[5] @37 F
text kccfhdbn[6] @38 E
text kccfhdbn[7] @39 I
ub4 kccfhcsq @40 0x000001d8
ub4 kccfhfsz @44 0x00001400
s_blkz kccfhbsz @48 0x00
ub2 kccfhfno @52 0x000c
ub2 kccfhtyp @54 0x0003
ub4 kccfhacid @56 0x00000000
ub4 kccfhcks @60 0x00000000
text kccfhtag[0] @64
text kccfhtag[1] @65
text kccfhtag[2] @66
text kccfhtag[3] @67
text kccfhtag[4] @68
text kccfhtag[5] @69
text kccfhtag[6] @70
text kccfhtag[7] @71
text kccfhtag[8] @72
text kccfhtag[9] @73
text kccfhtag[10] @74
text kccfhtag[11] @75
text kccfhtag[12] @76
text kccfhtag[13] @77
text kccfhtag[14] @78
text kccfhtag[15] @79
text kccfhtag[16] @80
text kccfhtag[17] @81
text kccfhtag[18] @82
text kccfhtag[19] @83
text kccfhtag[20] @84
text kccfhtag[21] @85
text kccfhtag[22] @86
text kccfhtag[23] @87
text kccfhtag[24] @88
text kccfhtag[25] @89
text kccfhtag[26] @90
text kccfhtag[27] @91
text kccfhtag[28] @92
text kccfhtag[29] @93
text kccfhtag[30] @94
text kccfhtag[31] @95
ub4 kcvfhrdb @96 0x00000000
struct kcvfhcrs, 8 bytes @100
ub4 kscnbas @100 0xc00a3405
ub2 kscnwrp @104 0x0b2c
ub4 kcvfhcrt @108 0x2ebeb8c3
ub4 kcvfhrlc @112 0x2e51408f
struct kcvfhrls, 8 bytes @116
ub4 kscnbas @116 0x0002ab78
ub2 kscnwrp @120 0x0000
ub4 kcvfhbti @124 0x00000000
struct kcvfhbsc, 8 bytes @128
ub4 kscnbas @128 0x00000000
ub2 kscnwrp @132 0x0000
ub2 kcvfhbth @136 0x0000
ub2 kcvfhsta @138 0x0000 (NONE)
struct kcvfhckp, 36 bytes @140
struct kcvcpscn, 8 bytes @140
ub4 kscnbas @140 0xc00b6467
ub2 kscnwrp @144 0x0b2c
ub4 kcvcptim @148 0x2ebf0c07
ub2 kcvcpthr @152 0x0001
union u, 12 bytes @156
struct kcvcprba, 12 bytes @156
ub4 kcrbaseq @156 0x00000015
ub4 kcrbabno @160 0x0000429a
ub2 kcrbabof @164 0x0010
struct kcvcptr, 12 bytes @156
struct kcrtrscn, 8 bytes @156
ub4 kscnbas @156 0x00000015
ub2 kscnwrp @160 0x429a
ub4 kcrtrtim @164 0x09110010
ub1 kcvcpetb[0] @168 0x02
ub1 kcvcpetb[1] @169 0x00
ub1 kcvcpetb[2] @170 0x00
ub1 kcvcpetb[3] @171 0x00
ub1 kcvcpetb[4] @172 0x00
ub1 kcvcpetb[5] @173 0x00
ub1 kcvcpetb[6] @174 0x00
ub1 kcvcpetb[7] @175 0x00
ub4 kcvfhcpc @176 0x0000000d
ub4 kcvfhrts @180 0x2ebeea4f
ub4 kcvfhccc @184 0x0000000c
struct kcvfhbcp, 36 bytes @188
struct kcvcpscn, 8 bytes @188
ub4 kscnbas @188 0x00000000
ub2 kscnwrp @192 0x0000
ub4 kcvcptim @196 0x00000000
ub2 kcvcpthr @200 0x0000
union u, 12 bytes @204
struct kcvcprba, 12 bytes @204
ub4 kcrbaseq @204 0x00000000
ub4 kcrbabno @208 0x00000000
ub2 kcrbabof @212 0x0000
struct kcvcptr, 12 bytes @204
struct kcrtrscn, 8 bytes @204
ub4 kscnbas @204 0x00000000
ub2 kscnwrp @208 0x0000
ub4 kcrtrtim @212 0x00000000
ub1 kcvcpetb[0] @216 0x00
ub1 kcvcpetb[1] @217 0x00
ub1 kcvcpetb[2] @218 0x00
ub1 kcvcpetb[3] @219 0x00
ub1 kcvcpetb[4] @220 0x00
ub1 kcvcpetb[5] @221 0x00
ub1 kcvcpetb[6] @222 0x00
ub1 kcvcpetb[7] @223 0x00
ub4 kcvfhbhz @224 0x00000000
struct kcvfhxcd, 16 bytes @228
ub4 space_kcvmxcd[0] @228 0x00000000
ub4 space_kcvmxcd[1] @232 0x00000000
ub4 space_kcvmxcd[2] @236 0x00000000
ub4 space_kcvmxcd[3] @240 0x00000000
word kcvfhtsn @244 12
ub2 kcvfhtln @248 0x0004
text kcvfhtnm[0] @250 B
text kcvfhtnm[1] @251 B
text kcvfhtnm[2] @252 E
text kcvfhtnm[3] @253 D
text kcvfhtnm[4] @254
text kcvfhtnm[5] @255
text kcvfhtnm[6] @256
text kcvfhtnm[7] @257
text kcvfhtnm[8] @258
text kcvfhtnm[9] @259
text kcvfhtnm[10] @260
text kcvfhtnm[11] @261
text kcvfhtnm[12] @262
text kcvfhtnm[13] @263
text kcvfhtnm[14] @264
text kcvfhtnm[15] @265
text kcvfhtnm[16] @266
text kcvfhtnm[17] @267
text kcvfhtnm[18] @268
text kcvfhtnm[19] @269
text kcvfhtnm[20] @270
text kcvfhtnm[21] @271
text kcvfhtnm[22] @272
text kcvfhtnm[23] @273
text kcvfhtnm[24] @274
text kcvfhtnm[25] @275
text kcvfhtnm[26] @276
text kcvfhtnm[27] @277
text kcvfhtnm[28] @278
text kcvfhtnm[29] @279
ub4 kcvfhrfn @280 0x0000000c
struct kcvfhrfs, 8 bytes @284
ub4 kscnbas @284 0x00000000
ub2 kscnwrp @288 0x0000
ub4 kcvfhrft @292 0x2ebee9f9
struct kcvfhafs, 8 bytes @296
ub4 kscnbas @296 0x00000000
ub2 kscnwrp @300 0x0000
ub4 kcvfhbbc @304 0x00000000
ub4 kcvfhncb @308 0x00000000
ub4 kcvfhmcb @312 0x00000000
ub4 kcvfhlcb @316 0x00000000
ub4 kcvfhbcs @320 0x00000000
ub2 kcvfhofb @324 0x0000
ub2 kcvfhnfb @326 0x0000
ub4 kcvfhprc @328 0x00000000
struct kcvfhprs, 8 bytes @332
ub4 kscnbas @332 0x00000000
ub2 kscnwrp @336 0x0000
struct kcvfhprfs, 8 bytes @340
ub4 kscnbas @340 0x00000000
ub2 kscnwrp @344 0x0000
ub4 kcvfhtrt @356 0x00000000
/*需要修改内容
ub4 rdba_kcbh @4 0x03000001
ub4 kccfhfsz @44 0x00001400
ub2 kccfhfno @52 0x000c
struct kcvfhcrs, 8 bytes @100
ub4 kscnbas @100 0xc00a3405
ub2 kscnwrp @104 0x0b2c
ub4 kcvfhrfn @280 0x0000000c
/
/*修改值(通过错误提示结合file$表)
rdba_kcbh 02c00001
kccfhfsz 00000500
kccfhfno 000b
kscnbas c00a32b8
kcvfhrfn 0000000b
/
BBED> set offset 4
OFFSET 4
BBED> m /x 0100c002
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 4 to 19 Dba:0x02c00001
------------------------------------------------------------------------
0100c002 00000000 00000104 0ab10000
<32 bytes per line>
BBED> set offset 44
OFFSET 44
BBED> m /x 00050000
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 44 to 59 Dba:0x02c00001
------------------------------------------------------------------------
00050000 00200000 0c000300 00000000
<32 bytes per line>
BBED> set offset 52
OFFSET 52
BBED> m /x
BBED-00203: incomplete/malformed command
BBED> m /x 0b00
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 52 to 67 Dba:0x02c00001
------------------------------------------------------------------------
0b000300 00000000 00000000 00000000
<32 bytes per line>
BBED> set offset 100
OFFSET 100
BBED> m /x b8320ac0
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 100 to 115 Dba:0x02c00001
------------------------------------------------------------------------
b8320ac0 2c0b0000 c3b8be2e 8f40512e
<32 bytes per line>
BBED> set offset 280
OFFSET 280
BBED> m /x 0b000000
File: /u01/oracle/oradata/xifenfei/bbed01.dbf (11)
Block: 1 Offsets: 280 to 295 Dba:0x02c00001
------------------------------------------------------------------------
0b000000 00000000 00000000 f9e9be2e
<32 bytes per line>
BBED> sum apply
Check value for File 11, Block 1:
current = 0xa777, required = 0xa777
重建控制文件open数据库
SQL> alter database backup controlfile to trace as '/tmp/t_xifenfie.ctl'; Database altered. SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 353441008 bytes Fixed Size 451824 bytes Variable Size 184549376 bytes Database Buffers 167772160 bytes Redo Buffers 667648 bytes SQL> CREATE CONTROLFILE REUSE DATABASE "XIFENFEI" NORESETLOGS ARCHIVELOG 2 MAXLOGFILES 50 3 MAXLOGMEMBERS 5 4 MAXDATAFILES 100 5 MAXINSTANCES 1 6 MAXLOGHISTORY 226 7 LOGFILE 8 GROUP 1 '/u01/oracle/oradata/xifenfei/redo01.log' SIZE 100M, 9 GROUP 2 '/u01/oracle/oradata/xifenfei/redo02.log' SIZE 100M, 10 GROUP 3 '/u01/oracle/oradata/xifenfei/redo03.log' SIZE 100M 11 DATAFILE 12 '/u01/oracle/oradata/xifenfei/system01.dbf', 13 '/u01/oracle/oradata/xifenfei/undotbs01.dbf', 14 '/u01/oracle/oradata/xifenfei/cwmlite01.dbf', 15 '/u01/oracle/oradata/xifenfei/drsys01.dbf', 16 '/u01/oracle/oradata/xifenfei/example01.dbf', 17 '/u01/oracle/oradata/xifenfei/indx01.dbf', 18 '/u01/oracle/oradata/xifenfei/odm01.dbf', 19 '/u01/oracle/oradata/xifenfei/tools01.dbf', 20 '/u01/oracle/oradata/xifenfei/users01.dbf', 21 '/u01/oracle/oradata/xifenfei/xdb01.dbf', 22 '/u01/oracle/oradata/xifenfei/bbed01.dbf', 23 '/u01/oracle/oradata/xifenfei/bbed02.dbf' 24 CHARACTER SET ZHS16GBK 25 ; Control file created. SQL> recover database ; ORA-00283: recovery session canceled due to errors ORA-00264: no recovery required SQL> alter database open; Database altered.
至此通过拷贝相同表空间的datafile header修复损坏的datafile header

加我微信(17813235971)
加我QQ(107644445)

