本文将详细说明如何解决oracle中asm磁盘添加失败的问题。边肖觉得很实用,分享给大家参考。希望你看完这篇文章能有所收获。
生产环境已被划分为存储和多路径聚合,由于缺乏经验,我们忘记配置udev。
向磁盘组添加磁盘时,数据库错误报告权限不足,简单认为对应字符设备的权限是root:disk,无法添加到磁盘组。
因此,在尝试使用chown命令在两个节点将角色设备的修改权限更改为grid:oinstall后,由于suse系统中udev的内部机制,在将角色设备添加到磁盘组的过程中,角色设备的权限自动从Grid 3360 oinstall更改为root:disk,导致添加磁盘失败。此时这个磁盘的头已经写了一些信息,HEADER_STATUS为NUMBER,无法重新添加到磁盘组,也无法将其踢出磁盘组,进退两难。
因为是生产环境,我们不敢随意操作,所以在测试环境中模拟问题,解决问题。
问题重复出现:
确认1 /dev/raw/raw6的HEADER_STATUS为候选状态,表示可以将其添加到asm磁盘组。
SQL从v$asm_disk中选择路径、名称、磁盘号、组号、状态、装载状态、标题状态、模式状态;
路径名磁盘号组号状态装载状态标题状态模式状态
- - - - - - - -
/dev/raw 6 0 0正常关闭候选人在线
/dev/raw/raw1 DATA_0000 0 2正常缓存成员在线
/dev/raw/raw3 DATA_0002 2 2正常缓存成员
; ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
2 查看磁盘组,模拟将/dev/raw/raw6加进磁盘组DATA。
SQL> select GROUP_NUMBER,NAME from v$asm_diskgroup;
GROUP_NUMBER NAME
------------ --------------------
1 DATA1
2 DATA
3 将/dev/raw/raw6加入磁盘组DATA的过程中(约等待3s),另开窗口,将/dev/raw/raw6的权限由grid:asmadmin改为root:disk,此时报错如下:
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15075: disk(s) are not visible cluster-wide
4 重启udev(即:将/dev/raw/raw6 权限重新改为grid:asmadmin) 并重新查询。
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw6 0 0 NORMAL CLOSED MEMBER ONLINE
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
5 此时尝试再次将/dev/raw/raw6加入DATA中,出现报错,模拟故障成功。
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk '/dev/raw/raw6' belongs to diskgroup "DATA"
解决方法:
查了oracle官方文档,提供了如下三种解决方法(1453285.1):
方法一:
1 备份问题磁盘
dd if=/dev/oracleasm/disks/EMCORA43 of=/tmp/EMCORA43.txt bs=1M count=10
2 修改磁盘权限
chmod 000 /dev/oracleasm/disks/EMCORA47
3 重新挂载diskgroup,确认diskgroup可以正常挂载,则可以使用dd命令清除盘头信息,并重新添加该磁盘。
dd if=/dev/zero of=/dev/oracleasm/disks/EMCORA43 bs=1M count=1
方法二:
使用oracleasm删除磁盘
/etc/init.d/oracleasm deletedisk EMCORA43
方法三:
使用force选项强制重新挂载该磁盘。
alter diskgroup XXXX add disk '/dev/oracleasm/disks/EMCORA43' force;
本次实验采用第三种方法:
具体如下:
SQL> select NAME, TOTAL_MB, FREE_MB, (TOTAL_MB - FREE_MB)
USED_MB, to_char((TOTAL_MB - FREE_MB) * 100 / TOTAL_MB,'99.99') || '%'
USED_PRECENT from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB USED_MB USED_PRECENT
-------------------- ---------- ---------- ---------- --------------
DATA1 1998 1901 97 4.85%
DATA 2997 630 2367 78.98%
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw6 0 0 NORMAL CLOSED MEMBER ONLINE
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
6 rows selected.
SQL> alter diskgroup DATA add disk '/dev/raw/raw6';
alter diskgroup DATA add disk '/dev/raw/raw6'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk '/dev/raw/raw6' belongs to diskgroup "DATA"
SQL> alter diskgroup DATA add disk '/dev/raw/raw6' force;
Diskgroup altered.
SQL> select PATH,NAME,DISK_NUMBER,GROUP_NUMBER,STATE,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS from v$asm_disk;
PATH NAME DISK_NUMBER GROUP_NUMBER STATE MOUNT_STATUS HEADER_STATUS MODE_STATUS
------------------------------ -------------------- ----------- ------------ ---------------- -------------- ------------------------ --------------
/dev/raw/raw1 DATA_0000 0 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw3 DATA_0002 2 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw4 DATA1_0000 0 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw5 DATA1_0001 1 1 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw2 DATA_0001 1 2 NORMAL CACHED MEMBER ONLINE
/dev/raw/raw6 DATA_0005 5 2 NORMAL CACHED MEMBER ONLINE
6 rows selected.
SQL> select NAME, TOTAL_MB, FREE_MB, (TOTAL_MB - FREE_MB) USED_MB, to_char((TOTAL_MB - FREE_MB) * 100 / TOTAL_MB,'99.99') || '%' USED_PRECENT from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB USED_MB USED_PRECENT
-------------------- ---------- ---------- ---------- --------------
DATA1 1998 1901 97 4.85%
DATA 3497 1128 2369 67.74%
实际测试中,第一和第三种方法都可行(因本测试环境未使用oracleasm,故不测试第二种)。
因第一种方法较为稳妥,故选择第一种方法在生产环境修复问题。
后续:
1、 几天后在生产环境pboss2-rdb1/2 江苏库使用第一种方法修复成功。但是引出一个问题:suse系统和rhel系统在udev上有一些差异,rhel修改完 /etc/udev/rules.d/下的 rules文件,通过命令start_udev启动udev即可。但是suse则需要如下操作/etc/init.d/boot.udev restart 重启udev配置,然后模拟拔插 udevadm test /sys/block/xxx 才能使设置生效。当时没发现这个差异,只能通过重启系统生效。
2、在asmdisk加进diskgroup后,正在做rebalance过程中,使用两种方法改变asmdisk权限。一种是直接操作系统chown命令改变两个节点的asmdisk,结果发现rebalance正常进行,diskgroup不受影响。另一种是使用udev改变asmdisk属性,重启udev使之生效,结果发现diskgroup异常,直接unmount,数据库实例down,把asmdisk权限修改回来后,重新alter diskgroup xxx mount后,发现rebalance继续进行,数据库重启后正常。
关于“oracle中如何解决asm磁盘添加失败问题”这篇文章就分享到这里了,希望
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/150547.html