问题背景:
在redhat 7.8上安装Oracle11G RAC集群,在节点一执行root.sh脚本时发生错误Disk Group OCRDG creation failed with the following message:ORA-15018: diskgroup cannot be created
问题分析:
从报错信息来看错误是在执行创建OCRDG磁盘组时失败,查看asm实例alert日志进一步查看磁盘组创建失败的错误信息
asm的alert日志里面可以看到OCRDG创建失败的原因是出现操作系统层的错误Linux-x86_64 Error: 22: Invalid argument,磁盘/dev/mapper/asm_ocrdg*IO错误
在Oracle mos文档Diskgroup creation fails with: ORA-15018: Diskgroup Cannot Be Created (Doc ID 2349830.1)匹配到了同样的创建磁盘组错误,原因为磁盘使用了4K的扇区
fdisk查看当前磁盘的扇区大小,果真为4K扇区与文档描述的一致
按照文档提供的解决方案,指定创建磁盘组的扇区sector_size=4096进行创建,但报错依然发生,方法失败
继续查找可能的解决方法,查到Oracle mos文档ASM Diskgroups Cannot Be Created On RedHat6 Using 4K(4096) SECTOR_SIZE Non-ASMLIB Disks (Doc ID 1961171.1)描述由于redhat 6的操作系统平台问题,导致ASM无法支持4k的磁盘扇区,这与当前操作系统版本redhat7.8并不匹配,但文档还提及到另一个原因,虽然redhat的新版本已经支持4K的磁盘扇区,但受制于Bug 21845832 : FILE CREATION ON ASM ORA-15080/ORA-27072 WITH 4K SECTOR DISKS的影响,在12.2之前的版本asm使用4k的磁盘创建,依然会出现创建失败的问题。
给出的解决方法是
1 磁盘恢复使用默认的512字节扇区
2 使用asmlib绑定磁盘设备,以支持ASM 4k扇区方法磁盘
决定使用asmlib方式绑定磁盘设备,配置步骤如下
#从Oracle官方下载Linux 7版本的asmlib
https://www.oracle.com/linux/downloads/linux-asmlib-rhel7-downloads.html
#节点一,节点二
--服务器按照asmlib
rpm -ivh oracleasm-support-2.1.11-2.el7.x86_64.rpm
rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm
--配置asmlib
[root@host01 tmp]# /usr/sbin/oracleasm configure -i
Configuring the Oracle ASM library driver.
Thost will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@host01 tmp]# /usr/sbin/oracleasm init
[root@host01 tmp]# systemctl enable oracleasm
[root@host01 tmp]# systemctl start oracleasm
#节点一,通过asmlib创建绑定磁盘
/usr/sbin/oracleasm createdisk OCRDG01 /dev/mapper/asm_ocrdg01
/usr/sbin/oracleasm createdisk OCRDG02 /dev/mapper/asm_ocrdg02
/usr/sbin/oracleasm createdisk OCRDG03 /dev/mapper/asm_ocrdg03
#节点二,通过smlib扫描磁盘,不需要执行创建绑定操作
oracleasm scandisks
oracleasm listdisks
[root@host02 tmp]# oracleasm listdisks
OCRDG01
OCRDG02
OCRDG03
asm实例添加asmlib磁盘的访问路径ORCL:*,需重启asm实例生效
SQL> CREATE DISKGROUP OCRDG NORMAL REDUNDANCY DISK 2 'ORCL:OCRDG01',3 'ORCL:OCRDG02',4 'ORCL:OCRDG03' 5 ATTRIBUTE 'compatible.asm'='11.2.0.0.0','au_size'='4M','SECTOR_SIZE'='4096';
Diskgroup created.
验证完成之后,卸载crs的配置重跑root.sh,脚本执行成功,问题得以解决