您的位置:首页 > 数据库 > Oracle

Oracle Linux 配置 UDEV SCSI Rules 说明

2012-04-06 18:18 393 查看
Oracle RAC中ASM 的配置可以有2种方式实现:raw和asmlib。 在实际的维护中,更推荐使用raw。

使用raw又有两种方法:使用multipath和UDEV。在Redhat 平台下参考:

Redhat 5.4 +ASM + RAW+ Oracle 10g RAC 安装文档

/article/1449247.html

Redhat 5.4Oracle 10g RAC Openfiler+Multipath + RAW+ ASM 安装文档

/article/1449200.html

对于ASMLIB,参考:

RAW+ASM 的RAC 安装文档

/article/1361909.html

这篇看一下OracleLinux 系统下UDEV的配置。

参考文档:

http://www.oracle-base.com/articles/linux/UdevScsiRulesConfigurationInOracleLinux5and6.php

http://www.oracle-base.com/articles/11g/OracleDB11gR2RACInstallationOnOracleLinux6UsingVirtualBox.php

我这里的实验平台是OracleLinux 6.1+Virtual Box。

OracleVirtual Box 安装使用 说明

/article/1448892.html

一.准备工作

1.1 创建共享磁盘

这里直接使用VirtualBox命令来创建。 创建之前需要先关闭虚拟机。

1.1.1 创建共享目录sharedisk:

F:\VBox\sharedisk

1.1.2 创建虚拟介质

C:\Users\Administrator.DavidDai>cd F:\VBox\sharedisk

C:\Users\Administrator.DavidDai>F:

F:\VBox\sharedisk>VBoxManage createhd --filename asm01.vdi --size 5120 --format VDI --variant Fixed

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Disk image created. UUID:83552343-5254-4fe0-8f4d-949389a4d528

F:\VBox\sharedisk>VBoxManage createhd --filename asm02.vdi --size 5120 --format VDI --variant Fixed

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Disk image created. UUID:b96d5ecb-168a-4eaf-851e-0f21961dae4e

F:\VBox\sharedisk>VBoxManage createhd --filename asm03.vdi --size 5120 --format VDI --variant Fixed

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Disk image created. UUID:fd7bba6c-9530-433f-a7e0-24d470ba1fb9

F:\VBox\sharedisk>VBoxManage createhd --filename asm04.vdi --size 5120 --format VDI --variant Fixed

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Disk image created. UUID:3239ed0d-bd0b-4124-a389-db21ecbb15db

1.1.3 将虚拟介质匹配到虚拟机上

F:\VBox\sharedisk>VBoxManage storageattach OraLinuxRAC1 --storagectl "SATA 控制器" --port 1 --device 0 --type hdd --medium asm01.vdi --mtype shareable

F:\VBox\sharedisk>VBoxManage storageattach OraLinuxRAC1 --storagectl "SATA 控制器" --port 2 --device 0 --type hdd --medium asm02.vdi --mtype shareable

F:\VBox\sharedisk>VBoxManage storageattach OraLinuxRAC1 --storagectl "SATA 控制器" --port 3 --device 0 --type hdd --medium asm03.vdi --mtype shareable

F:\VBox\sharedisk>VBoxManage storageattach OraLinuxRAC1 --storagectl "SATA 控制器" --port 4 --device 0 --type hdd --medium asm04.vdi --mtype shareable

几点注意的地方:

(1) 控制器名称

我这里写的是:"SATA控制器",因为我的虚拟机是中文显示的,如下图:



如果是英语的,这里名称就要写成:"SATA Controller",如:

F:\VBox\sharedisk>VBoxManagestorageattach OraLinuxRAC1 --storagectl "SATA Controller" --port 1--device 0 --type hdd --medium asm04.vdi --mtype shareable

(2)storageattach 对应的是VM中显示的虚拟机的名称,我这里OraLinuxRAC1.

(3)如果要将磁盘加到其他的节点上,只需要更改这里的虚拟机名称即可。如:

F:\VBox\sharedisk>VBoxManage storageattach OraLinuxRAC2 --storagectl "SATA 控制器" --port 4 --device 0 --typehdd --medium asm04.vdi --mtype shareable

1.1.4 配置虚拟介质共享,这个在VBOX界面也可以操作,这里使用命令

此信息将被记入到每个虚拟磁盘文件的文件头中,故其他其他再使用的时候就无需再设置成共享了。

F:\VBox\sharedisk>VBoxManage modifyhd asm01.vdi --type shareable

F:\VBox\sharedisk>VBoxManage modifyhd asm02.vdi --type shareable

F:\VBox\sharedisk>VBoxManage modifyhd asm03.vdi --type shareable

F:\VBox\sharedisk>VBoxManage modifyhd asm04.vdi --type shareable

1.2 格式化共享介质

启动虚拟机,进行格式化操作

[root@rac1 ~]# cd /dev

[root@rac1 dev]# ls sd*

sda sda1 sda2 sda3 sdb sdc sdd sde

--这里的sdb,sdc,sdd,sde就是我们添加的虚拟介质。

[root@rac1 dev]# fdisk -l

Disk /dev/sda: 16.1 GB, 16106127360 bytes

255 heads, 63 sectors/track, 1958 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x0008dd19

Device Boot Start End Blocks Id System

/dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinderboundary.

/dev/sda2 26 154 1024000 82 Linux swap / Solaris

Partition 2 does not end on cylinderboundary.

/dev/sda3 154 1959 14498816 83 Linux

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a validpartition table

Disk /dev/sdc: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a validpartition table

Disk /dev/sdd: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00000000

Disk /dev/sdd doesn't contain a validpartition table

Disk /dev/sde: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00000000

Disk /dev/sde doesn't contain a validpartition table

[root@rac1 dev]#

开始格式化介质:

[root@rac1 dev]# fdisk /dev/sdb

Device contains neither a valid DOSpartition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with diskidentifier 0xbe1b86b0.

Changes will remain in memory only, untilyou decide to write them.

After that, of course, the previous contentwon't be recoverable.

Warning: invalid flag 0x0000 of partitiontable 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-652, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G}(1-652, default 652):

Using default value 652

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@rac1 dev]#

重复以上操作,格式化剩下的3个介质。

验证:

[root@rac1 dev]# ls sd*

sda sda1 sda2 sda3 sdb sdb1 sdc sdc1 sdd sdd1 sde sde1

[root@rac1 dev]# fdisk -l

Disk /dev/sda: 16.1 GB, 16106127360 bytes

255 heads, 63 sectors/track, 1958 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x0008dd19

Device Boot Start End Blocks Id System

/dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinderboundary.

/dev/sda2 26 154 1024000 82 Linux swap / Solaris

Partition 2 does not end on cylinderboundary.

/dev/sda3 154 1959 14498816 83 Linux

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0xbe1b86b0

Device Boot Start End Blocks Id System

/dev/sdb1 1 652 5237158+ 83 Linux

Disk /dev/sdc: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x52c60017

Device Boot Start End Blocks Id System

/dev/sdc1 1 652 5237158+ 83 Linux

Disk /dev/sdd: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0xb3564300

Device Boot Start End Blocks Id System

/dev/sdd1 1 652 5237158+ 83 Linux

Disk /dev/sde: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x688384a0

Device Boot Start End Blocks Id System

/dev/sde1 1 652 5237158+ 83 Linux

You have new mail in /var/spool/mail/root

[root@rac1 dev]#

二. 配置UDEV

2.1 确定SCSI ID

在Oracle Linux 5下,可以使用如下命令:

# /sbin/scsi_id -g -u -s /block/sdb/sdb1

SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_

# /sbin/scsi_id -g -u -s /block/sdc/sdc1

SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_

# /sbin/scsi_id -g -u -s /block/sdd/sdd1

SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_

# /sbin/scsi_id -g -u -s /block/sde/sde1

SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_

#

这里的-s 选项,在Oracle Linux 6 中已经不可用了,我这里的环境也是OracleLinux 6的,所以使用命令如下:

[root@rac1 dev]# /sbin/scsi_id -g -u /dev/sdb1

1ATA_VBOX_HARDDISK_VB83552343-28d5a489

[root@rac1 dev]# /sbin/scsi_id -g -u /dev/sdc1

1ATA_VBOX_HARDDISK_VBb96d5ecb-4eae1d96

[root@rac1 dev]# /sbin/scsi_id -g -u /dev/sdd1

1ATA_VBOX_HARDDISK_VBfd7bba6c-b91fba70

[root@rac1 dev]# /sbin/scsi_id -g -u /dev/sde1

1ATA_VBOX_HARDDISK_VB3239ed0d-db15bbec

2.2 创建并配置UDEVRules 文件

[root@rac1 rules.d]# touch /etc/udev/rules.d/99-oracle-asmdevices.rules

添加如下内容:

KERNEL=="sd?1",BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB83552343-28d5a489",NAME="asm-disk1", OWNER="oracle", GROUP="dba",MODE="0660"

KERNEL=="sd?1",BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBb96d5ecb-4eae1d96",NAME="asm-disk2", OWNER="oracle", GROUP="dba",MODE="0660"

KERNEL=="sd?1",BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBfd7bba6c-b91fba70",NAME="asm-disk3", OWNER="oracle", GROUP="dba",MODE="0660"

KERNEL=="sd?1",BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB3239ed0d-db15bbec",NAME="asm-disk4", OWNER="oracle", GROUP="dba",MODE="0660"

2.3 Load updated block device partition tables.

# /sbin/partprobe /dev/sdb1

# /sbin/partprobe /dev/sdc1

# /sbin/partprobe /dev/sdd1

# /sbin/partprobe /dev/sde1

2.4 重启UDEV

[root@rac1 dev]# start_udev

Starting udev: [ OK ]

2.5 检查共享设备的所属关系和权限

[root@rac1 rules.d]# cd /dev

[root@rac1 dev]# ls -al asm-disk*

brw-rw----. 1 oracle dba 8, 17 Apr 6 18:04 asm-disk1

brw-rw----. 1 oracle dba 8, 33 Apr 6 18:04 asm-disk2

brw-rw----. 1 oracle dba 8, 49 Apr 6 18:04 asm-disk3

brw-rw----. 1 oracle dba 8, 65 Apr 6 18:04 asm-disk4

至此配置结束,在ASM的配置中,ASM_DISKSTRING参数指向'/dev/asm-disk*'就可以了。

-------------------------------------------------------------------------------------------------------

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Skype: tianlesoftware

Email: tianlesoftware@gmail.com

Blog: http://www.tianlesoftware.com

Weibo: http://weibo.com/tianlesoftware

Twitter: http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)

DBA 超级群:63306533(满); DBA4 群:83829929 DBA5群: 142216823

DBA6 群:158654907 DBA7 群:172855474 DBA总群:104207940
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: