1 实验环境
准备两个分区,每个65530 MB,作为ASM磁盘组的两个磁盘;
将两个磁盘加入ASM磁盘组;
使用操作系统的工具重新调整磁盘大小为61530 MB,但是却没有在ASM层面执行ALTER DISKGROUP RESIZE DISK操作以模拟故障环境。
2 处理方法
受影响的(ORCL:DATA09 和 ORCL:DATA10)ASMLIB磁盘:
$ ls -l /dev/oracleasm/disks
brw-rw---- 1 oracle dba 8, 2 Mar 14 11:25 DATA01
...
brw-rw---- 1 oracle dba 8, 161 Mar 14 11:25 DATA09
brw-rw---- 1 oracle dba 8, 177 Mar 14 11:25 DATA10
2.1 检查ASM磁盘头信息
$ kfed read /dev/oracleasm/disks/DATA09
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfdhdb.driver.provstr: ORCLDISKDATA09 ; 0x000: length=14
kfdhdb.dsknum: 4 ; 0x024: 0x0004
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATA09 ; 0x028: length=6
kfdhdb.grpname: DG1 ; 0x048: length=3
kfdhdb.fgname: DATA09 ; 0x068: length=6
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 32934511 ; 0x0a8: HOUR=0xf DAYS=0x13 MNTH=0x2 YEAR=0x7da
kfdhdb.crestmp.lo: 1158806528 ; 0x0ac: USEC=0x0 MSEC=0x7f SECS=0x11 MINS=0x11
kfdhdb.mntstmp.hi: 32934511 ; 0x0b0: HOUR=0xf DAYS=0x13 MNTH=0x2 YEAR=0x7da
kfdhdb.mntstmp.lo: 1158852608 ; 0x0b4: USEC=0x0 MSEC=0xac SECS=0x11 MINS=0x11
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
...
上面可以看到磁盘头信息正常,同样检查DATA10的磁盘头信息。
2.2 检查ASM磁盘头关于磁盘大小信息
$ kfed read /dev/oracleasm/disks/DATA09 | egrep "dskname|dsksize"
kfdhdb.dskname: DATA09 ; 0x028: length=6
kfdhdb.dsksize: 65530 ; 0x0c4: 0x0000fffa
$ kfed read /dev/oracleasm/disks/DATA10 | egrep "dskname|dsksize"
kfdhdb.dskname: DATA10 ; 0x028: length=6
kfdhdb.dsksize: 65530 ; 0x0c4: 0x0000fffa
发现两个磁盘头记录两个磁盘的大小都是65530 MB
在操作系统层面检查磁盘大小
# ls -l /dev/sd* | egrep "8, 161|8, 177"
brw-rw---- 1 root disk 8, 161 Mar 14 11:25 sdk1
brw-rw---- 1 root disk 8, 177 Mar 14 11:25 sdl1
# fdisk -l /dev/sdk
Disk /dev/sdk: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdk1 1 7844 63006898+ 83 Linux
# fdisk -l /dev/sdl
Disk /dev/sdl: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdl1 1 7844 63006898+ 83 Linux
可以看出每个磁盘大小为61530 MB
2.3 使用kfed更改磁盘头信息
读取磁盘头信息到文件
$ kfed read /dev/oracleasm/disks/DATA09 > /tmp/DATA09_header.kfed
编辑文件并修改/tmp/DATA09_header.kfed
kfdhdb.dsksize: 65530 ; 0x0c4: 0x0000fffa
更改为
kfdhdb.dsksize: 61530 ; 0x0c4: 0x0000f05a
对DATA10做同样的操作
修改磁盘头的信息
$ kfed merge /dev/oracleasm/disks/DATA09 text=/tmp/DATA09_header.kfed
$ kfed merge /dev/oracleasm/disks/DATA10 text=/tmp/DATA10_header.kfed
2.4 挂载磁盘组并在ASM实例更新磁盘大小
$ sqlplus / as sysdba (or 'sqlplus / as sysasm' 或者 ASM 11.1以后)
SQL> alter diskgroup DG1 resize disk DATA09 size 61530 M;
SQL> alter diskgroup DG1 resize disk DATA10 size 61530 M;
重新mount测试磁盘是否正常。