手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

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

[日期:2018-05-13] 来源:Linux社区  作者:AlfredZhao [字体: ]

环境: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盘:

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

本文永久更新链接地址https://www.linuxidc.com/Linux/2018-05/152365.htm

linux
相关资讯       ASMLib创建ASM  ASMLib 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款