阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

利用ASMLib创建ASM磁盘实践心得

145次阅读
没有评论

共计 5097 个字符,预计需要花费 13 分钟才能阅读完成。

环境:RHEL 6.5 + Oracle 11.2.0.4 RAC(2 nodes)
目的:在实验环境使用 ASMLib 配置共享 ASM 磁盘,虽然我们已经不建议使用 ASMLib 进行绑盘,但是无奈有客户是这样做的,而作为一名合格的乙方技术人员,我们是需要熟悉不同技术(包括这种已经不再推荐使用的技术)从而更好的为甲方服务。

1. 安装 ASMLib 相关包
2. 配置 ASMLib
3. 安装 GI 时选择 ASM 磁盘

1. 安装 ASMLib 相关包

安装 ASMLib 一共需要 3 个 rpm 包,分别是 kmod-oracleasm,oracleasmlib 和 oracleasm-support,注意选择合适的版本安装,比如我这里环境:
[root@linuxidcrac1 tmp]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
  1:oracleasm-support      ########################################### [100%]
[root@linuxidcrac1 tmp]# rpm -ivh kmod-oracleasm-2.0.6.rh1-3.el6_5.x86_64.rpm
warning: kmod-oracleasm-2.0.6.rh1-3.el6_5.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing…                ########################################### [100%]
  1:kmod-oracleasm        ########################################### [100%]
[root@linuxidcrac1 tmp]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
  1:oracleasmlib          ########################################### [100%]
[root@linuxidcrac1 tmp]#

节点 2 用同样的步骤安装这三个 rpm 软件包,不再赘述。

2. 配置 ASMLib

2.1 ASMLib 的配置如下:
[root@linuxidcrac1 ~]# /etc/init.d/oracleasm configure
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) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [OK]
Scanning the system for Oracle ASMLib disks:
[OK]

– 节点 2 同样:
[root@linuxidcrac2 ~]# /etc/init.d/oracleasm configure
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) [y]: 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]
Scanning the system for Oracle ASMLib disks: [OK]

2.2 使用 oracleasm createdisk 创建 ASM 磁盘:
[root@linuxidcrac1 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk “VOL1” as an ASM disk: [OK]
[root@linuxidcrac1 ~]# /etc/init.d/oracleasm deletedisk VOL1
Removing ASM disk “VOL1”: [OK]

– 我这里环境有 7 块盘,ASMLib 使用的盘需要分区,每块盘整个分一个区即可:
/etc/init.d/oracleasm createdisk OCR1 /dev/sdb1
/etc/init.d/oracleasm createdisk OCR2 /dev/sdc1
/etc/init.d/oracleasm createdisk OCR3 /dev/sdd1
/etc/init.d/oracleasm createdisk DATA1 /dev/sde1
/etc/init.d/oracleasm createdisk DATA2 /dev/sdf1
/etc/init.d/oracleasm createdisk DATA3 /dev/sdg1
/etc/init.d/oracleasm createdisk FRA1 /dev/sdh1

2.3 使用 oracleasm scandisks 扫盘然后 listdisks 列出
/etc/init.d/oracleasm scandisks
 /etc/init.d/oracleasm listdisks
[root@linuxidcrac2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [OK]
[root@linuxidcrac2 ~]# /etc/init.d/oracleasm listdisks
DATA1
DATA2
DATA3
FRA1
OCR1
OCR2
OCR3
[root@linuxidcrac2 ~]#

2.4 使用 oracleasm querydisk 查询磁盘是否有效
/etc/init.d/oracleasm querydisk
[root@linuxidcrac2 rules.d]# /etc/init.d/oracleasm querydisk DATA1
Disk “DATA1” is a valid ASM disk

2.5 parted 分区的示例
 既然 ASMLib 需要使用分区过的,那就使用 parted 对每块 LUN 进行分区,示例如下:
[root@linuxidcrac1 ~]# parted /dev/sdh
GNU Parted 2.1
Using /dev/sdh
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt                                                     
(parted) p                                                               
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdh: 369MB
Sector size (logical/physical): 12B/12B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0-1                                             
End? 369M                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I                                                         
(parted) p                                                               
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdh: 369MB
Sector size (logical/physical): 12B/12B
Partition Table: gpt

Number  Start  End    Size    File system  Name    Flags
 1      17.kB  369MB  369MB              primary

(parted) q                                                               
Information: You may need to update /etc/fstab.   

2.6 oracleasm 命令
/etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@linuxidcrac2 ~]# /etc/init.d/oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@linuxidcrac2 ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@linuxidcrac2 ~]#

3. 安装 GI 时选择 ASM 磁盘

diskstrings 设置为 ORCL:*,正常就可以看到类似下面这样的 ASM 盘:

利用 ASMLib 创建 ASM 磁盘实践心得

更多 Oracle 相关信息见 Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-22发表,共计5097字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中