如何使用Linux块设备分区创建ASM(使用UDEV,而非ASMLIB)

APPLIES TO: 

Oracle Database - Standard Edition - Version 10.2.0.1 to 12.1.0.2 [Release 10.2 to 12.1]
Information in this document applies to any platform.

GOAL

The present document provides an example about how to setup/configure partitioned Linux block devices using udev (non-ASMLIB)  and assign them to ASM as candidate member disks.

SOLUTION

1) This example was performed on an OEL 6.3 configuration (ASM release 11.2.0.3 - 64-bit):

[grid@asmlnx2 ~]$ uname -a
Linux asmlnx2 2.6.39-200.24.1.el6uek.x86_64 #1 SMP Sat Jun 23 02:39:07 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

[grid@asmlnx2 ~]$ cat /etc/*release*

Oracle Linux Server release 6.3
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Oracle Linux Server release 6.3

 

2) Identify the new disk in your Linux configuration (e.g. OEL 6.3 or RedHat 6.3):

[grid@asmlnx2 ~]$ ls -l  /dev/xvdv
brw-rw---- 1 root disk 202, 5376 Feb 11 21:31 /dev/xvdv

 

3) Create a new disk partition on it:

[root@asmlnx2 ~]#  fdisk  /dev/xvdv
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xba335ded.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): 
Using default value 261

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

[root@asmlnx2 ~]# partprobe  /dev/xvdv

 

[root@asmlnx2 ~]# partprobe  /dev/xvdv1

 

[root@asmlnx2 ~]# ls -l  /dev/xvdv
brw-rw---- 1 root disk 202, 5376 Feb 11 21:38 /dev/xvdv

 

[root@asmlnx2 ~]# ls -l  /dev/xvdv1
brw-rw---- 1 root disk 202, 5377 Feb 11 21:38 /dev/xvdv1

 

 

4) Set the new UDEV rules on the new partition (“/dev/xvdv1”) as follows:

[root@asmlnx2 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="xvdv1", NAME="asmdisk1_udev_p1", OWNER="grid", GROUP="asmadmin", MODE="0660"

 (我是修改的是/etc/udev/rules.d/60-raw.rules,不知道和这个99开头的有什么区别;另外需要注意OWNER和GROUP,权限有时候也会写成775)

5) Reload and Restart the udev rules:

[root@asmlnx2 ~]# udevadm control --reload-rules

[root@asmlnx2 ~]# start_udev
Starting udev:                                             [  OK  ]

 


6) Make sure the new udev partition device is created with the correct ownership (grid & asmadmin) and permissions (brw-rw----):

[root@asmlnx2 ~]# ls -ltr /dev/asm*
brw-rw---- 1 grid asmadmin 202, 5377 Feb 11 21:47 /dev/asmdisk1_udev_p1

 

7) Now you can use it to create a new diskgroup or add it to an existing diskgroup as follows:


[root@asmlnx2 ~]# su - grid
[grid@asmlnx2 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM
The Oracle base has been set to /u01/app/grid
[grid@asmlnx2 ~]$ sqlplus "/as sysasm"

SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 11 21:56:31 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option


SQL> show parameter asm_diskstring

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring                       string


SQL> alter system set asm_diskstring =  '/dev/asmdisk1_udev_p1' scope=both;

System altered.


SQL> show parameter  asm_diskstring

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring                       string        /dev/asmdisk1_udev_p1



SQL> select path from v$asm_disk where path like '%udev%';

PATH
--------------------------------------------------------------------------------
/dev/asmdisk1_udev_p1


SQL> create diskgroup UDEVDG external redundancy disk  '/dev/asmdisk1_udev_p1'  ;

Diskgroup created.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值