当前位置:Gxlcms > mysql > 当ASM磁盘组无法MOUNT之时如何找到对应的物理磁盘?

当ASM磁盘组无法MOUNT之时如何找到对应的物理磁盘?

时间:2021-07-01 10:21:17 帮助过:79人阅读

如果数据存放于ASM磁盘组之上,当ASM磁盘组无法MOUNT起来,则意味着无法打开数据库。我们假设磁盘头部没有损坏,只是盘符变了,但无法正确设置ASM_DISKSTRING参数。 实验环境: RHEL5 + ORACLE10.2.0.4RAC+RAW+ASM 通过此次实验你将掌握以下知识点: 1. 初步

如果数据存放于ASM磁盘组之上,当ASM磁盘组无法MOUNT起来,则意味着无法打开数据库。我们假设磁盘头部没有损坏,只是盘符变了,但无法正确设置ASM_DISKSTRING参数。

实验环境: RHEL5 + ORACLE10.2.0.4RAC+RAW+ASM

通过此次实验你将掌握以下知识点:

1. 初步了解如何使用ORACLE两款内部工具amdu/kfed

2. 在ASM磁盘组无法MOUNT的情况下,如何对应物理磁盘和ASMDISK的关系

3. 当ASM_DISKSTRING设置不全时,如何补全并将磁盘组MOUNT起来。

SQL> ALTER DISKGROUP ALL MOUNT
Sat Nov 29 22:15:09 2014
NOTE: cache registered group DATA number=1 incarn=0x5bc84523
Sat Nov 29 22:15:09 2014
NOTE: Hbeat: instance first (grp 1)
Sat Nov 29 22:15:13 2014
NOTE: start heartbeating (grp 1)
NOTE: cache opening disk 0 of grp 1: DATA_0000 path:/dev/raw/raw3 <<<<<<<
Sat Nov 29 22:15:13 2014
NOTE: F1X0 found on disk 0 fcn 0.619
NOTE: cache opening disk 1 of grp 1: DATA_0001 path:/dev/raw/raw4 <<<<<<<
NOTE: cache mounting (first) group 1/0x5BC84523 (DATA)
* allocate domain 1, invalid = TRUE
Sat Nov 29 22:15:13 2014
NOTE: attached to recovery domain 1
Sat Nov 29 22:15:13 2014
NOTE: starting recovery of thread=1 ckpt=23.573 group=1
NOTE: advancing ckpt for thread=1 ckpt=23.573
NOTE: cache recovered group 1 to fcn 0.5267
Sat Nov 29 22:15:13 2014
NOTE: opening chunk 1 at fcn 0.5267 ABA
NOTE: seq=24 blk=574
Sat Nov 29 22:15:13 2014
NOTE: cache mounting group 1/0x5BC84523 (DATA) succeeded
SUCCESS: diskgroup DATA was mounted

下面我们取消raw3,raw4裸设备的定义,重启操作系统...

SQL> alter diskgroup all mount;
alter diskgroup all mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"

SQL> alter system set asm_diskstring='/dev/sdd1'; <<<<<此处只添加一块盘符

System altered.

SQL> alter diskgroup data mount;
alter diskgroup data mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "1" is missing <<<<<<依旧缺失一块盘符





[oracle@dwdb1 tmp]$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
[oracle@dwdb1 tmp]$ ./amdu -diskstring='/dev/sd*' -dump 'DATA' <<<<<扫描/dev/sd*所有设备
[oracle@dwdb1 tmp]$ cd amdu_2014_11_30_08_28_26
[oracle@dwdb1 amdu_2014_11_30_08_28_26]$ ls -lrt
total 94364
-rw-r--r-- 1 oracle oinstall 7231 Nov 30 08:28 report.txt

-rw-r--r-- 1 oracle oinstall 8000 Nov 30 08:28 DATA.map
-rw-r--r-- 1 oracle oinstall 96514048 Nov 30 08:28 DATA_0001.img

截取部分report.txt内容:

----------------------------- DISK REPORT N0010 ------------------------------
Disk Path: /dev/sdd1
Unique Disk ID:
Disk Label:
Physical Sector Size: 512 bytes
Disk Size: 1019 megabytes
Group Name: DATA
Disk Name: DATA_0000
Failure Group Name: DATA_0000
Disk Number: 0
Header Status: 3
Disk Creation Time: 2014/11/05 12:55:10.506000
Last Mount Time: 2014/11/29 23:14:47.663000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 1019 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes
AU Size: 1048576 bytes
Stride: 113792 AUs
Group Creation Time: 2014/11/05 12:55:10.486000
File 1 Block 1 location: AU 2

----------------------------- DISK REPORT N0012 ------------------------------
Disk Path: /dev/sde1 <<<<<<<<<<<<<<<<<磁盘全路径
Unique Disk ID:
Disk Label:
Physical Sector Size: 512 bytes
Disk Size: 1019 megabytes
Group Name: DATA
Disk Name: DATA_0001
Failure Group Name: DATA_0001
Disk Number: 1 <<<<<<<<<<<<<<<<<<<<<<<<<磁盘序号为1
Header Status: 3
Disk Creation Time: 2014/11/05 13:01:56.714000
Last Mount Time: 2014/11/29 23:14:47.663000
Compatibility Version: 0x0a100000
Disk Sector Size: 512 bytes
Disk size in AUs: 1019 AUs
Group Redundancy: 1
Metadata Block Size: 4096 bytes
AU Size: 1048576 bytes
Stride: 113792 AUs
Group Creation Time: 2014/11/05 12:55:10.486000
File 1 Block 1 location: AU 0

...
------------------------- SUMMARY FOR DISKGROUP DATA -------------------------
Allocated AU's: 1632
Free AU's: 406
AU's read for dump: 100
Block images saved: 23563
Map lines written: 100
Heartbeats seen: 0
Corrupt metadata blocks: 0
Corrupt AT blocks: 0


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

结合以上信息,使用KFED再次确认:

[oracle@dwdb1 tmp]$ kfed read /dev/sde1 |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: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
kfbh.check: 1289251580 ; 0x00c: 0x4cd86afc
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

这样,就可以确定disk1就为/dev/sde1了

SQL> alter system set asm_diskstring='/dev/sdd1','/dev/sde1';

System altered.

SQL> alter diskgroup data mount;

Diskgroup altered.

接下来就可以启动数据库了。

以上简单地使用了AMDU/KFED命令,这两款具都可以实现在ASM磁盘组无法MOUNT的情况下对磁盘读写,其中KFED命令还可以用于磁盘头部的修复(10.2.5.0以上的数据库全有自动备份),还可以做异常恢复:从ASM磁盘直接恢复数据文件,总之也是个非常强大的工具。

人气教程排行