Oracle 使用KFED/ DD修复ASM磁盘头损坏

如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!

诗檀软件专业数据库修复团队

服务热线 : 13764045638    QQ号:47079569    邮箱:[email protected]

 

概述

  • 注意不要在生产系统上运行这些命令,因为很容易就会损坏数据
  • ASM 11.1.0.7版本及更高版本中,ASM磁盘头块在分配单元1中的倒数第二个ASM元数据块中有备份

Kfed 参数

  • aun -读取分配单位(AU)号码。默认值是AU0,或ASM磁盘的开始
  • aus – AU大小. 默认为1048576 (1MB). 从非默认AU大小的磁盘组读取时,指定AUS。
  • blkn – 读块号。默认值是块0,或者AU的第一个块。
  • dev – ASM磁盘或设备名称。注意,关键字dev可以省略,但ASM磁盘名称是必须的。

了解ASM 磁盘布局

Read ASM disk header block from  AU[0]

[root@grac41 Desktop]# kfed read  /dev/asm_test_1G_disk1 | egrep ‘name|size|type’

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD   <– ASM disk header

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9          <– ASM disk name

kfdhdb.grpname:                    TEST ; 0x048: length=4          <– ASM DG name

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9          <– ASM Failgroup

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200            <– Disk sector size

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000            <– ASM block size

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000        <– AU size : 1 Mbyte

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff        <– ASM disk size : 1 GByte  

 

Check ASM block types for the first 2 AUs

AU[0] :

[root@grac41 Desktop]# kfed find /dev/asm_test_1G_disk1

Block 0 has type 1

Block 1 has type 2

Block 2 has type 3

Block 3 has type 3

Block 4 has type 3

Block 5 has type 3

Block 6 has type 3

Block 7 has type 3

Block 8 has type 3

Block 9 has type 3

Block 10 has type 3

..

Block 252 has type 3

Block 253 has type 3

Block 254 has type 3

Block 255 has type 3

 

AU[1] :

[root@grac41 Desktop]#  kfed find /dev/asm_test_1G_disk1 aun=1

Block 256 has type 17

Block 257 has type 17

Block 258 has type 13

Block 259 has type 18

Block 260 has type 13

..

Block 508 has type 13

Block 509 has type 13

Block 510 has type 1

Block 511 has type 19

 

Summary :

–> Disk header size is 512 bytes

    AU size = 1Mbyte  –> AU block size = 4096

    This translates to 1048576 / 4096 = 256 blocks to read an AU ( start with block 0 – 255 )

    Block 510 and block 0 storing an ASM disk header ( == type 1 )

 

Run the kfed command below if you interested in a certain ASM block type ( use output from kfed find to the type info )

[root@grac41 Desktop]#  kfed read  /dev/asm_test_1G_disk1 aun=1 blkn=255  | egrep ‘type’

kfbh.type:                           19 ; 0x002: KFBTYP_HBEAT

 

Some ASM block types

[root@grac41 Desktop]# kfed read  /dev/asm_test_1G_disk1 aun=0 blkn=0  | egrep ‘type’

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfbh.type:                            2 ; 0x002: KFBTYP_FREESPC

kfbh.type:                            3 ; 0x002: KFBTYP_ALLOCTBL

kfbh.type:                            5 ; 0x002: KFBTYP_LISTHEAD

kfbh.type:                           13 ; 0x002: KFBTYP_PST_NONE

kfbh.type:                           18 ; 0x002: KFBTYP_PST_DTA

kfbh.type:                           19 ; 0x002: KFBTYP_HBEAT

AU[0] kfed修复磁盘头块

  • ASM 11.1.0.7版本及更高版本中,ASM磁盘头块在分配单元1中的倒数第二个ASM元数据块中有备份

Verify ASM DISK Header block located in  AU[0] and AU[1]

AU[0] :

[root@grac41 Desktop]# kfed read  /dev/asm_test_1G_disk1 aun=0 blkn=0 | egrep ‘name|size|type’

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9

kfdhdb.grpname:                    TEST ; 0x048: length=4

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff

 

AU[1] :

[root@grac41 Desktop]# kfed read  /dev/asm_test_1G_disk1 aun=1 blkn=254  | egrep ‘name|size|type’

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9

kfdhdb.grpname:                    TEST ; 0x048: length=4

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff

 

Erase Disk header block in first AU ( aun=0 blkn=0 )

# dd if=/dev/zero of=/dev/asm_test_1G_disk1  bs=4096 count=1

 

Verify ASM disk header

# kfed read /dev/asm_test_1G_disk1 aun=0 blkn=0

kfbh.type:                            0 ; 0x002: KFBTYP_INVALID

KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]

–> Corrupted ASM disk header detected in AU [0]

 

Repair disk header in AU[0] with kfed

[grid@grac41 ASM]$ kfed repair  /dev/asm_test_1G_disk1

[grid@grac41 ASM]$ kfed read /dev/asm_test_1G_disk1 aun=0 blkn=0

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9

kfdhdb.grpname:                    TEST ; 0x048: length=4

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff

–> kfed repair worked – Disk header restored

kfed可以修复存储在第二个AU中的磁盘头块吗 ?

Delete  Disk header block in AU[1]

First use dd to figure out whether we are getting the correct block

[grid@grac41 ASM]$  dd if=/dev/asm_test_1G_disk1 of=-  bs=4096 count=1 skip=510 ; strings block1

1+0 records in

1+0 records out

4096 bytes (4.1 kB) copied, 0.000464628 s, 8.8 MB/s

ORCLDISK

TEST_0000

TEST

TEST_0000

–> looks like an ASM disk header – go ahead and erase that block

 

[grid@grac41 ASM]$  dd if=/dev/zero of=/dev/asm_test_1G_disk1  bs=4096 count=1  seek=510

1+0 records in

1+0 records out

4096 bytes (4.1 kB) copied, 0.00644028 s, 636 kB/s

 

Verify ASM disk header block in AU[1]

[grid@grac41 ASM]$ kfed read /dev/asm_test_1G_disk1 aun=1 blkn=254

kfbh.type:                            0 ; 0x002: KFBTYP_INVALID

KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]

–> Corrupted ASM disk header detected

 

[grid@grac41 ASM]$ kfed repair  /dev/asm_test_1G_disk1

KFED-00320: Invalid block num1 = [0], num2 = [1], error = [endian_kfbh]

–> kfed repair doesn’ work

 

Repair block with dd

grid@grac41 ASM]$ dd if=/dev/asm_test_1G_disk1  bs=4096  count=1 of=/dev/asm_test_1G_disk1  bs=4096 count=1  seek=510

1+0 records in

1+0 records out

4096 bytes (4.1 kB) copied, 0.0306682 s, 134 kB/s

[grid@grac41 ASM]$ kfed read /dev/asm_test_1G_disk1 aun=0 blkn=0

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9

kfdhdb.grpname:                    TEST ; 0x048: length=4

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff

 

# kfed read /dev/asm_test_1G_disk1 aun=1 blkn=254

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfdhdb.dskname:               TEST_0000 ; 0x028: length=9

kfdhdb.grpname:                    TEST ; 0x048: length=4

kfdhdb.fgname:                TEST_0000 ; 0x068: length=9

kfdhdb.capname:                         ; 0x088: length=0

kfdhdb.secsize:                     512 ; 0x0b8: 0x0200

kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000

kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000

kfdhdb.dsksize:                    1023 ; 0x0c4: 0x000003ff

 

Summary:

 to fix the backup block or the ASM disk header in AU 1 block you need to use dd

 

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *