Oracle如何安装配置ASMLIB
Oracle如何安装配置ASMLIB
官方安装参考文档/链接
FAQ ASMLIB CONFIGURE,VERIFY, TROUBLESHOOT (Doc ID 359266.1)
Oracle Linux: Oracleasm Kernel Driver for the 64-bit (x86_64) Red Hat Compatible Kernel for Oracle Linux 6 (Doc ID 1578579.1)
How To Install ASMLIB on Oracle Linux 6 And Red Hat Enterprise Linux 6 (Doc ID 1555785.1)
How to Configure LUNs for ASM Disks using WWID, DM-Multipathing, and ASMLIB on RHEL 5/OL 5 and RHEL 6/OL 6 and RHEL7 (Doc ID 1365511.1)
以Oracle Linux 6.9的uek为例子。
安装ASMLIB能够正确安装对应内核的版本一般不会有问题,按照我前篇博文介绍Oracle如何从官方渠道下载ASMLIB组件安装包 进行下载。
安装如下:
[root@oracle1 soft]# uname -a Linux oracle1 4.1.12-37.4.1.el6uek.x86_64 #2 SMP Tue May 17 07:23:38 PDT 2016 x86_64 x86_64 x86_64 GNU/Linux [root@oracle1 soft]# rpm -ivh oracleasm-support-2.1.11-2.el6.x86_64.rpm Preparing... ########################################### [100%] 1:oracleasm-support ########################################### [100%] [root@oracle1 soft]# rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:oracleasmlib ########################################### [100%]
关于安装oracleasm包,上边第一个链接中有个“yum install -y oracleasm”命令,实际我经过测试并没有oracleasm的包,只是几十个其他的包进行升级或补充安装,并不一定要执行。
配置
需要先创建好组和用户。
[root@oracle1 soft]# /usr/sbin/oracleasm init Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": oracleasm Configuring "oracleasm" to use device physical block size Mounting ASMlib driver filesystem: /dev/oracleasm [root@oracle1 soft]# /etc/init.d/oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes [root@oracle1 soft]# /etc/init.d/oracleasm configure -i Configuring the Oracle ASM library driver. This 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 Initializing the Oracle ASMLib driver: [ OK ] [root@oracle1 soft]# chkconfig oracleasm --list oracleasm 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@oracle1 soft]# service oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes
说明:
/usr/sbin/oracleasm init会生成配置文件/etc/sysconfig/oracleasm(软链接)和oracleasm-_dev_oracleasm,且生成目录/dev/oracleasm/,挂载ASMLIB驱动文件系统。
/etc/init.d/oracleasm configure -i配置会对/etc/sysconfig/oracleasm进行对应修改。
日志文件全路径:more /var/log/oracleasm
配置并标记磁盘。
我的测试盘有个/dev/sdb,需要fdisk
或parted
先进行分区。略。
[root@oracle1 soft]# /etc/init.d/oracleasm createdisk ocr /dev/sdb1 Marking disk "ocr" as an ASM disk: [ OK ] [root@oracle1 soft]# /etc/init.d/oracleasm listdisks OCR [root@oracle1 soft]# ll /dev/oracleasm/disks total 0 brw-rw---- 1 grid asmadmin 8, 17 Jan 5 19:41 OCR [root@oracle1 ~]# blkid /dev/sda1: UUID="696dc71c-45c4-4de9-95b2-d5f48a749b86" TYPE="ext4" /dev/sda2: UUID="d60bc951-2ce7-4b29-93be-8962b2aae200" TYPE="swap" /dev/sda3: UUID="f0cf272c-6fb0-4f5f-9b1d-c9b6d2e2f548" TYPE="ext4" /dev/sdb1: LABEL="OCR" TYPE="oracleasm" [root@oracle1 ~]# oracleasm-discover Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so [ASM Library - Generic Linux, version 2.0.12 (KABI_V2)] Discovered disk: ORCL:OCR [10474317 blocks (5362850304 bytes), maxio 512, integrity none] [root@oracle1 ~]# oracleasm-discover ORCL:* Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so [ASM Library - Generic Linux, version 2.0.12 (KABI_V2)] Discovered disk: ORCL:OCR [10474317 blocks (5362850304 bytes), maxio 512, integrity none]
其他RAC节点不需要“oracleasm createdisk”,只需要进行扫描即可。
/etc/init.d/oracleasm scandisks
注意,安装grid或者dbca或者asmca过程中使用有ASMLIB管理的盘必须使用磁盘发现字符串:ORCL:*
盘的前缀为"ORCL:",如上边创建的盘名应为ORCL:OCR
不然就不对。
更多关于/etc/init.d/oracleasm或/usr/sbin/oracleasm的使用管理见:https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/administering-oracle-asmlib-and-disks.html
关于无法使用ORCL:来发现盘的,找了几个mos文档案例:防。
基本都是安装的oracleasmlib和oracle-support包有问题,我自己遇到了一个包没问题但是无法发现ORCL:来发现盘的,搞了几天才找到问题,mos还没有一样案例的。
ASM is Unable to Detect ASMLIB DisksDevices. (Doc ID 457369.1)
ASMASMCA New Installation Is Not Detecting Candidate ASMLIB Disks on Oracle Linux (OL) UEK (Doc ID 1926939.1)
https://www.cnblogs.com/PiscesCanon/p/17967951
我个人不太喜欢asmlib的,摘个别人列出的几个缺点:这里
1. 对于多路径设备(multipathing)需要在/etc/sysconfig/oracleasm-_dev_oracleasm配置⽂件中设置 ORACLEASM_SCANORDER及ORACLEASM_SCANEXCLUDE,以便ASMLIB能找到正确的设备⽂ 件,具体可以参考Metalink Note
2. 因为ASM INSTANCE使⽤ASMLIB提供的asm disk,所以增加了额外的层⾯
3. 每次Linux Kernel更新,都需要替换新的ASMLIB包
4. 增加了因⼈为错误造成宕机downtime的可能
5. 使⽤ASMLIB意味着要花费更多时间去创建和维护
6. 因为ASMLIB的存在,可能引⼊更多的bug,这是我们最不想看到的
7. 使⽤ASMLIB创建的disk,其disk header并不会和普通的asm disk header有什么不同,仅仅是在头部多出了ASMLIB的属性空间。 尽可能不要使⽤ASMLIB