重构asm disk header

1. 实验环境

[oracle@roger oracle]$ export ORACLE_SID=+alex
[oracle@roger oracle]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Nov 29 21:35:41 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> show parameter asm

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      DATA01
asm_diskstring                       string      /dev/sdb, /dev/sdc
asm_power_limit                      integer     1
SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@roger oracle]$ 

—-我这里只有一个ASM diskgroup data01,其中data01中包含2个disk。

2. 备份asm disk header

[oracle@roger oracle]$ dd if=/dev/sdc of=/oracle/sdc_header.dd bs=4096 count=1
1+0 records in
1+0 records out
[oracle@roger oracle]$ ls -ltr sdc*
-rw-r--r--  1 oracle dba 4096 Nov 29 21:37 sdc_header.dd
[oracle@roger oracle]$ 

3. 模拟asm disk header 异常损坏

[oracle@roger oracle]$ cp sdc_header.dd  test_header.dd
[oracle@roger oracle]$ ls -ltr *header*
-rw-r--r--  1 oracle dba 4096 Nov 29 21:37 sdc_header.dd
-rw-r--r--  1 oracle dba 4096 Nov 29 21:39 test_header.dd
[oracle@roger oracle]$ 

使用FTP 将test_header.dd 取回到xp系统本地,用ultraedit随便编辑多处保存后再ftp传到linux中

[oracle@roger oracle]$ 
[oracle@roger oracle]$ ls -ltr *.dd
-rw-r--r--  1 oracle dba 4096 Nov 29 21:37 sdc_header.dd
-rw-r--r--  1 oracle dba 4096 Nov 29  2010 test_header.dd
[oracle@roger oracle]$ 

下面我们使用kfed 的merge功能 来看看结果

[oracle@roger oracle]$ dd if=/dev/zero of=/dev/sdc bs=4096 count=1
1+0 records in
1+0 records out
[oracle@roger oracle]$ kfed read /dev/sdc
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                            0 ; 0x001: 0x00
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:                       0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check:                           0 ; 0x00c: 0x00000000
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ dd if=/dev/sdb of=/oracle/sdb_header.dd bs=4096 count=1
1+0 records in
1+0 records out
[oracle@roger oracle]$ ls -ltr *.dd
-rw-r--r--  1 oracle dba 4096 Nov 29 21:37 sdc_header.dd
-rw-r--r--  1 oracle dba 4096 Nov 29 21:49 sdb_header.dd
-rw-r--r--  1 oracle dba 4096 Nov 29  2010 test_header.dd
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ dd if=/oracle/sdb_header.dd of=/dev/sdc bs=4096 count=1
1+0 records in
1+0 records out
[oracle@roger oracle]$ kfed read /dev/sdc
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                  1270824540 ; 0x00c: 0x4bbf3e5c
kfbh.fcn.base:                     2455 ; 0x010: 0x00000997
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:         ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]:            0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:             DATA01_0000 ; 0x028: length=11
kfdhdb.grpname:                  DATA01 ; 0x048: length=6
kfdhdb.fgname:              DATA01_0000 ; 0x068: length=11
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32943381 ; 0x0a8: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da
kfdhdb.crestmp.lo:           2776384512 ; 0x0ac: USEC=0x0 MSEC=0x311 SECS=0x17 MINS=0x29
kfdhdb.mntstmp.hi:             32944053 ; 0x0b0: HOUR=0x15 DAYS=0x1d MNTH=0xb YEAR=0x7da
kfdhdb.mntstmp.lo:           3073473536 ; 0x0b4: USEC=0x0 MSEC=0x5f SECS=0x33 MINS=0x2d
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    5120 ; 0x0c4: 0x00001400
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:            65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]:            65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]:            65535 ; 0x0de: 0xffff
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32943381 ; 0x0e4: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da
kfdhdb.grpstmp.lo:           2776307712 ; 0x0e8: USEC=0x0 MSEC=0x2c6 SECS=0x17 MINS=0x29
kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
。。。。。。。省略部分内容
kfdhdb.acdb.aba.blk:                  0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents:                     0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare:                 0 ; 0x1de: 0x0000
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Nov 29 21:52:40 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ORA-15032: not all alterations performed
ORA-15036: disk '/dev/sdc' is truncated

SQL> 

——由于/dev/sdb和 /dev/sdc 是在同一个磁盘组中,所以我这里直接把/dev/sdb的header dd出来,然后dd到/dev/sdc中的。
当然你可以使用kfed的 merge功能。从这里我们可以看出,DATA01磁盘组已经无法mount了。

4. 开始手工重构ASM DISK header

下面是此时/dev/sdc 的header 信息

[oracle@roger oracle]$ kfed read /dev/sdc|more
kfbh.endian:                          1 ; 0x000: 0x01                ---不用修改
kfbh.hard:                          130 ; 0x001: 0x82                ---不用修改
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD     ---不用修改
kfbh.datfmt:                          1 ; 0x003: 0x01                ---不用修改
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0        ---不用修改
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0   ---不用修改
kfbh.check:                  1270824540 ; 0x00c: 0x4bbf3e5c
kfbh.fcn.base:                     2455 ; 0x010: 0x00000997
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:         ORCLDISK ; 0x000: length=8            ----不用修改
kfdhdb.driver.reserved[0]:            0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000        ----这里是oracle版本,不用修改
kfdhdb.dsknum:                        0 ; 0x024: 0x0000             ----这里需要进行修改  即使磁盘组中disk的编号,默认是从0开始。

                     ------0 ; 0x024: 0x0000  修改为  1 ; 0x024: 0x0001
                       
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:             DATA01_0000 ; 0x028: length=11            ----这里需要进行修改

                     ------DATA01_0000 ; 0x028: length=11 修改为
                           DATA01_0001 ; 0x028: length=11
                     
                     
kfdhdb.grpname:                  DATA01 ; 0x048: length=6
kfdhdb.fgname:              DATA01_0000 ; 0x068: length=11            ----这里需要进行修改 

                     ------DATA01_0000 ; 0x068: length=11 修改为
                           DATA01_0001 ; 0x068: length=11
            
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32943381 ; 0x0a8: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da    ----从alert log中获取时间 然后转换为16进制 这里年 月我们不用改了  

    -------HOUR=0x15 DAYS=0x8  MNTH=0xb YEAR=0x7da  修改后为 
           HOUR=0x15 DAYS=0x1c MNTH=0xb YEAR=0x7da 

kfdhdb.crestmp.lo:           2776384512 ; 0x0ac: USEC=0x0 MSEC=0x311 SECS=0x17 MINS=0x29

           ---0x0ac: USEC=0x0 MSEC=0x311 SECS=0x17 MINS=0x29 修改为
              0x0ac: USEC=0x0 MSEC=0x311 SECS=0x18 MINS=0x32

kfdhdb.mntstmp.hi:             32944053 ; 0x0b0: HOUR=0x15 DAYS=0x1d MNTH=0xb YEAR=0x7da   

   -------- 32944053 ; 0x0b0: HOUR=0x15 DAYS=0x1d MNTH=0xb YEAR=0x7da  修改为     
   
            32944053 ; 0x0b0: HOUR=0x15 DAYS=0x1c MNTH=0xb YEAR=0x7da

  
kfdhdb.mntstmp.lo:           3073473536 ; 0x0b4: USEC=0x0 MSEC=0x5f SECS=0x33 MINS=0x2d

   ---------0x0b4: USEC=0x0 MSEC=0x5f SECS=0x33 MINS=0x2d   修改为
            0x0b4: USEC=0x0 MSEC=0x5f SECS=0x18 MINS=0x32
  
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    5120 ; 0x0c4: 0x00001400       ----- 这里需要修改 修改为204M   

                     -----5120 ; 0x0c4: 0x00001400  修改为
                           204 ; 0x0c4: 0x000000cc
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002       -----这里需要进行修改

                ------- 2 ; 0x0d4: 0x00000002 修改为
                        0 ; 0x0d4: 0x00000000
                 
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:            65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]:            65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]:            65535 ; 0x0de: 0xffff
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32943381 ; 0x0e4: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da    ---这里需要修改

  ------ HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da   修改为
         HOUR=0x15 DAYS=0x1c MNTH=0xb YEAR=0x7da
  
kfdhdb.grpstmp.lo:           2776307712 ; 0x0e8: USEC=0x0 MSEC=0x2c6 SECS=0x17 MINS=0x29    

----- 0x0e8: USEC=0x0 MSEC=0x2c6 SECS=0x17 MINS=0x29 修改为
       0x0ac: USEC=0x0 MSEC=0x311 SECS=0x18 MINS=0x32  
       
kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
。。。。。。省略部分                                           

关于前面的时间如何确定呢? 很简单 我们可以从alert log中去寻找 我这里的时间是:

SQL> alter diskgroup data01 add disk '/dev/sdc'               
Sun Nov 28 21:50:24 2010                                      
NOTE: initializing header on grp 1 disk DATA01_0001           
NOTE: cache opening disk 1 of grp 1: DATA01_0001 path:/dev/sdc
NOTE: PST update: grp = 1                                     
NOTE: requesting all-instance disk validation for group=1     
Sun Nov 28 21:50:24 2010                                      
NOTE: disk validation pending for group 1/0xcffa9ca7 (DATA01) 
SUCCESS: validated disks for 1/0xcffa9ca7 (DATA01)       

跟alert中的信息,我们可以将10进制转换为16进制,进而得到kfffdb.crets.hi的值,不过有个问题是:
kfffdb.crets.lo的值精确到了微秒,单从这里来看的话,就无法精确的确定了,那怎么办呢? 有个工具我们可以使用
那就是admu 对于10g的话,需要到metalink上下载,11g的话,oracle已经自带了。 下面补充一个admu的信息

[oracle@roger amdu_2010_12_01_20_49_04]$ cat report.txt
-*-amdu-*-

******************************* AMDU Settings ********************************
ORACLE_HOME = /oracle/product/10.2/db
System name:    Linux
Node name:      roger
Release:        2.6.9-42.ELsmp
Version:        #1 SMP Wed Jul 12 23:27:17 EDT 2006
Machine:        i686
amdu run:       01-DEC-10 20:49:04
Endianess:      1

--------------------------------- Operations ---------------------------------
       -dump DATA01

------------------------------- Disk Selection -------------------------------
-diskstring '/dev/sdc'

------------------------------ Reading Control -------------------------------

------------------------------- Output Control -------------------------------

********************************* DISCOVERY **********************************

----------------------------- DISK REPORT N0001 ------------------------------
                Disk Path: /dev/sdc
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 204 megabytes       --- disk大小
               Group Name: DATA01
                Disk Name: DATA01_0001
       Failure Group Name: DATA01_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2010/11/28 21:50:24.844000      ----从这里我们就可以确定 kfdhdb.crestmp.lo
          Last Mount Time: 2010/12/01 20:04:31.391000
    Compatibility Version: 0x0a100000
         Disk Sector Size: 512 bytes
         Disk size in AUs: 204 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2010/11/08 21:41:23.710000
  File 1 Block 1 location: AU 0

***************** Slept for 6 seconds waiting for heartbeats *****************

************************* SCANNING DISKGROUP DATA01 **************************
            Creation Time: 2010/11/08 21:41:23.710000
         Disks Discovered: 1
               Redundancy: 1
                  AU Size: 1048576 bytes
      Metadata Block Size: 4096 bytes
     Physical Sector Size: 512 bytes
          Metadata Stride: 113792 AU
   Duplicate Disk Numbers: 0


---------------------------- SCANNING DISK N0001 -----------------------------
Disk N0001: '/dev/sdc'
           Allocated AU's: 45
                Free AU's: 159
       AU's read for dump: 5
       Block images saved: 769
        Map lines written: 5
          Heartbeats seen: 0
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


------------------------ SUMMARY FOR DISKGROUP DATA01 ------------------------
           Allocated AU's: 45
                Free AU's: 159
       AU's read for dump: 5
       Block images saved: 769
        Map lines written: 5
          Heartbeats seen: 0
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0


******************************* END OF REPORT ******************************

修改完以后呢 我们使用kfed merge功能把text信息cp到/dev/sdc中,操作如下:

[oracle@roger oracle]$ kfed merge /dev/sdc text=sdc.txt                            
[oracle@roger oracle]$                                                        
[oracle@roger oracle]$                                                        
[oracle@roger oracle]$ sqlplus "/as sysdba"                                   
                                                                              
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Nov 29 22:26:00 2010         
                                                                              
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.                       
                                                                              
                                                                              
Connected to:                                                                 
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production        
With the Partitioning, OLAP, Data Mining and Real Application Testing options 
                                                                              
SQL> shutdown immediate;                                                      
ORA-15100: invalid or missing diskgroup name                                  
                                                                              
                                                                              
ASM instance shutdown                                                         
SQL>                                                                          
SQL> startup                                                                  
ASM instance started                                                          
                                                                              
Total System Global Area   83886080 bytes                                     
Fixed Size                  1265912 bytes                                     
Variable Size              57454344 bytes                                     
ASM Cache                  25165824 bytes                                     
ORA-00600: internal error code, arguments: [kfcMount35], [2], [1], [], [], [],
[], []                                                                        
                                                                              
                                                                              
SQL>  

——-报错了 我们来看看此时的alert信息是怎么样的呢 ?

Mon Nov 29 22:26:13 2010                                                                                                                                     
NOTE: start heartbeating (grp 1)                                                     
NOTE: cache opening disk 0 of grp 1: DATA01_0000 path:/dev/sdb                       
Mon Nov 29 22:26:13 2010                                                             
NOTE: F1X0 found on disk 0 fcn 0.2455                                                
NOTE: cache opening disk 1 of grp 1: DATA01_0001 path:/dev/sdc                       
NOTE: F1X0 found on disk 1 fcn 0.2455                                                
NOTE: cache mounting (first) group 1/0x52FFF4D1 (DATA01)                             
Mon Nov 29 22:26:13 2010                                                             
Errors in file /oracle/product/admin/+ASM/udump/+alex_ora_5878.trc:                  
ORA-00600: internal error code, arguments: [kfcMount35], [2], [1], [], [], [], [], []
ERROR: ORA-600 signalled during mount of diskgroup DATA01                            
NOTE: cache dismounting group 1/0x52FFF4D1 (DATA01)                                  
ERROR: diskgroup DATA01 was not mounted   

然后继续修改header文件 又做了如下修改:

kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0   --- 这里也需要修改

                          修改后的结果为: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
                          
                          
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:            65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]:            65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]:            65535 ; 0x0de: 0xffff                         

修改为:
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000                                 
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000                                 
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000                                 
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000

再次尝试启动asm实例 仍然报错,错误如下:

[oracle@roger oracle]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Nov 29 22:48:03 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> 
SQL> 
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ORA-15032: not all alterations performed
ORA-15066: offlining disk "DATA01_0001" may result in a data loss
ORA-15044: ASM disk 'DATA01_0001' is incorrectly named

SQL>                          

从上面的错误来看 慢慢的有点靠谱了。。。。呵呵 我有信心把这个asm磁盘组mount起来。

仔细的看 kfed read /dev/sdc |more 信息 然后把base值清空 如下:

kfbh.fcn.base:                     2455 ; 0x010: 0x00000997

  ----修改为  kfbh.fcn.base:          0 ; 0x010: 0x00000000

最后把txt文件 merge进去 再次尝试启动asm实例,结果如下:

[oracle@roger oracle]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Dec 1 20:00:44 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ORA-15032: not all alterations performed
ORA-15066: offlining disk "DATA01_0001" may result in a data loss
ORA-15044: ASM disk 'DATA01_0001' is incorrectly named

依然出问题 看来还是有些地方没弄对啊 再回头来看看。。。 仔细看了一下 应该在跟时间有关的地方不对

前面修改的有些乱了 下面来重新整理一下:

其他地方用修改了 主要修改2个地方 即红色的部分

kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:              2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
kfbh.check:                  1653987462 ; 0x00c: 0x6295d886
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:         ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]:            0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        1 ; 0x024: 0x0001
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:             DATA01_0001 ; 0x028: length=11
kfdhdb.grpname:                  DATA01 ; 0x048: length=6
kfdhdb.fgname:              DATA01_0001 ; 0x068: length=11
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32944021 ; 0x0a8: HOUR=0x15 DAYS=0x1c MNTH=0xb YEAR=0x7da
kfdhdb.crestmp.lo:           3381473280 ; 0x0ac: USEC=0x0 MSEC=0x34c SECS=0x18 MINS=0x32
kfdhdb.mntstmp.hi:             32944180 ; 0x0b0: HOUR=0x14 DAYS=0x1 MNTH=0xc YEAR=0x7da
kfdhdb.mntstmp.lo:             53712896 ; 0x0b4: USEC=0x0 MSEC=0xe6 SECS=0x33 MINS=0x0kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                     204 ; 0x0c4: 0x000000cc
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      0 ; 0x0d4: 0x00000000
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32943381 ; 0x0e4: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da
kfdhdb.grpstmp.lo:           2776307712 ; 0x0e8: USEC=0x0 MSEC=0x2c6 SECS=0x17 MINS=0x29kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]:                   0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]:                   0 ; 0x0f4: 0x00000000
。。。。。省略部分信息
kfdhdb.ub4spare[57]:                  0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq:                  0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk:                  0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents:                     0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare:                 0 ; 0x1de: 0x0000     

那么关于红色的地方 我是如何确定的呢? 其实很简单 首先我们要搞清楚它的含义

kfdhdb.mntstmp.hi
kfdhdb.mntstmp.lo
kfdhdb.grpstmp.hi
kfdhdb.grpstmp.lo   这4个参数我们其实很容易确定的,为什么?

kfdhdb.mntstmp是指磁盘mount的时间,既然在同一个磁盘组,那也就是说同一个磁盘组的该值应该是一样的,那这就好办了。
另外 kfdhdb.grpstmp 是整个磁盘组的时间,那就更容易理解了。
我们直接从data01磁盘组中的另外一个disk中获取信息,然后直接复制过来即可。

下面是/dev/sdb的信息,其中红色的部分是我们需要复制的:

[oracle@roger ~]$ kfed read /dev/sdb
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                  3984081373 ; 0x00c: 0xed7841dd
kfbh.fcn.base:                     2455 ; 0x010: 0x00000997
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:         ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]:            0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:             DATA01_0000 ; 0x028: length=11
kfdhdb.grpname:                  DATA01 ; 0x048: length=6
kfdhdb.fgname:              DATA01_0000 ; 0x068: length=11
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32943381 ; 0x0a8: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da
kfdhdb.crestmp.lo:           2776384512 ; 0x0ac: USEC=0x0 MSEC=0x311 SECS=0x17 MINS=0x29
kfdhdb.mntstmp.hi:             32944180 ; 0x0b0: HOUR=0x14 DAYS=0x1 MNTH=0xc YEAR=0x7da
kfdhdb.mntstmp.lo:            301341696 ; 0x0b4: USEC=0x0 MSEC=0x187 SECS=0x1f MINS=0x4kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    5120 ; 0x0c4: 0x00001400
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:            65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]:            65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]:            65535 ; 0x0de: 0xffff
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32943381 ; 0x0e4: HOUR=0x15 DAYS=0x8 MNTH=0xb YEAR=0x7da
kfdhdb.grpstmp.lo:           2776307712 ; 0x0e8: USEC=0x0 MSEC=0x2c6 SECS=0x17 MINS=0x29kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]:                   0 ; 0x0f0: 0x00000000     

编辑完以后,我们将信息写入到a.txt中,然后使用kfed,最后启动asm实例看看,过程如下:

[oracle@roger oracle]$ 
[oracle@roger oracle]$ kfed merge /dev/sdc text=a.txt
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ 
[oracle@roger oracle]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Wed Dec 1 20:04:24 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> 
SQL> 
SQL> 
SQL>               ------从上面我们可以看出,asm 磁盘组成功mount,说明我们手工重构asm disk header成功! 

总的来说,其实大多数的信息,我们完全可以从同一磁盘组中的其他disk中获取,部分信息需要手工修改,比如disk大小,创建时间,磁盘组中disk编号等等。

Trackback

no comment untill now

Add your comment now

切换到手机版