如何使用udev给rac asm

如何使用udev给rac asm,第1张

机器上面使用的磁盘

[root@rac-db2 ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track,

5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector

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

I/O size (minimum/optimal):

512 bytes / 512 bytes

Disk identifier: 0x00081b38

Device Boot

Start

End Blocks Id

System

/dev/sda1

*

15100

40960000 83

Linux

/dev/sda2

5100

5222 982016 82 Linux swap /

Solaris

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130

cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size

(logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512

bytes / 512 bytes

Disk identifier: 0x4af1bcf1

Device Boot

Start

End Blocks Id System

Disk /dev/sdc: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130

cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size

(logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512

bytes / 512 bytes

Disk identifier: 0x45528f9a

Device Boot

Start

End Blocks Id System

Disk /dev/sdd: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130

cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size

(logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512

bytes / 512 bytes

Disk identifier: 0xf65dbdac

Device Boot

Start

End Blocks Id System

Disk /dev/sde: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130

cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size

(logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512

bytes / 512 bytes

Disk identifier: 0xe0e7f25c

Device Boot

Start

End Blocks Id System

Disk /dev/sdf: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130

cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size

(logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512

bytes / 512 bytes

Disk identifier: 0x4b720782

Device Boot

Start

End Blocks Id System

其中sdb sdc sdd sde sdf是给oracle asm使用的磁盘

下面是配置udev的过程:

1、得到每个磁盘对应的scsi id号,使用命令如下:

[root@rac-db1 ~]# scsi_id -g -u

/dev/sdb

36000c29a982d7d5fe0af684b22046b34

[root@rac-db1 ~]# scsi_id

-g -u /dev/sdc

36000c294085e61228085d870db2173af

[root@rac-db1

~]# scsi_id -g -u

/dev/sdd

36000c29a1a053b53514c7202e9fd2658

[root@rac-db1 ~]# scsi_id

-g -u /dev/sde

36000c29ffa47abfd932ddf3a2f598633

[root@rac-db1

~]# scsi_id -g -u /dev/sdf

36000c292926acffd78b0a49f27d62c51

2、编辑udev的配置文件

编辑文件/etc/udev/rules.d/99-oracle-asmdevices.rules,内容如下:

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p",

RESULT=="36000c29a982d7d5fe0af684b22046b34", NAME="asmgrid_disk1",

OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi",

PROGRAM=="/sbin/scsi_id -g -u -s %p",

RESULT=="36000c294085e61228085d870db2173af", NAME="asmgrid_disk2",

OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi",

PROGRAM=="/sbin/scsi_id -g -u -s %p",

RESULT=="36000c29a1a053b53514c7202e9fd2658", NAME="asmgrid_disk3",

OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi",

PROGRAM=="/sbin/scsi_id -g -u -s %p",

RESULT=="36000c29ffa47abfd932ddf3a2f598633", NAME="asmgrid_disk4",

OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", BUS=="scsi",

PROGRAM=="/sbin/scsi_id -g -u -s %p",

RESULT=="36000c292926acffd78b0a49f27d62c51", NAME="asmgrid_disk5",

OWNER="grid", GROUP="asmadmin", MODE="0660"

3、加载配置文件

[root@rac-db1 /]# udevadm control reload-rules

4、重启udev服务

[root@rac-db1 /]# start_udev

Starting udev: [ OK ]

5、检查配置结果

[root@rac-db1 /]# ls -l /dev/asm*

brw-rw---- 1 grid asmadmin 8, 16 Aug 31

11:11 /dev/asmgrid_disk1

brw-rw---- 1 grid asmadmin 8, 32 Aug 31 11:11

/dev/asmgrid_disk2

brw-rw---- 1 grid asmadmin 8, 48 Aug 31 11:11

/dev/asmgrid_disk3

brw-rw---- 1 grid asmadmin 8, 64 Aug 31 11:11

/dev/asmgrid_disk4

brw-rw---- 1 grid asmadmin 8, 80 Aug 31 11:11

/dev/asmgrid_disk5

[root@rac-db1 proc]# udevadm info --query=all --path=/block/sdc

P:

/devices/pci0000:00/0000:00:11.0/0000:02:05.0/host3/target3:0:1/3:0:1:0/block/sdc

N:

asmgrid_disk2

W: 50

S: block/8:32

S:

disk/by-id/scsi-36000c294085e61228085d870db2173af

S:

disk/by-path/pci-0000:02:05.0-scsi-0:0:1:0

S:

disk/by-id/wwn-0x6000c294085e61228085d870db2173af

E: UDEV_LOG=3

E:

DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:05.0/host3/target3:0:1/3:0:1:0/block/sdc

E:

MAJOR=8

E: MINOR=32

E: DEVNAME=/dev/asmgrid_disk2

E: DEVTYPE=disk

E:

SUBSYSTEM=block

E: ID_SCSI=1

E: ID_VENDOR=VMware

E:

ID_VENDOR_ENC=VMware\x20\x20

E: ID_MODEL=Virtual_disk

E:

ID_MODEL_ENC=Virtual\x20disk\x20\x20\x20\x20

E: ID_REVISION=1.0

E:

ID_TYPE=disk

E: ID_SERIAL_RAW=36000c294085e61228085d870db2173af

E:

ID_SERIAL=36000c294085e61228085d870db2173af

E:

ID_SERIAL_SHORT=6000c294085e61228085d870db2173af

E:

ID_WWN=0x6000c294085e6122

E: ID_WWN_VENDOR_EXTENSION=0x8085d870db2173af

E:

ID_WWN_WITH_EXTENSION=0x6000c294085e61228085d870db2173af

E:

ID_SCSI_SERIAL=6000c294085e61228085d870db2173af

E: ID_BUS=scsi

E:

ID_PATH=pci-0000:02:05.0-scsi-0:0:1:0

E: ID_PART_TABLE_TYPE=dos

E:

LVM_SBIN_PATH=/sbin

E: UDISKS_PRESENTATION_NOPOLICY=0

E:

UDISKS_PARTITION_TABLE=1

E: UDISKS_PARTITION_TABLE_SCHEME=mbr

E:

UDISKS_PARTITION_TABLE_COUNT=0

E: DEVLINKS=/dev/block/8:32

/dev/disk/by-id/scsi-36000c294085e61228085d870db2173af

/dev/disk/by-path/pci-0000:02:05.0-scsi-0:0:1:0

/dev/disk/by-id/wwn-0x6000c294085e61228085d870db2173af

[root@rac-db1 proc]#

配置了udev后, *** 作系统fdisk命令看不到asm使用的磁盘

[root@rac-db1 proc]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track,

5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector

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

I/O size (minimum/optimal):

512 bytes / 512 bytes

Disk identifier: 0x000cc4c1

Device Boot

Start

End Blocks Id

System

/dev/sda1

*

15100

40960000 83

Linux

/dev/sda2

5100

5222 982016 82 Linux swap /

Solaris

对于rac中其他节点,把99-oracle-asmdevices.rules copy过去,再执行步骤3,4就可以了。

题目如下所示:

在Oracle中,创建ASM磁盘的方式有哪几种?

答案如下所示:

可以通过ASMLIB、udev及Faking的方式来创建ASM磁盘。其中,Faking的方式不需要额外添加磁盘,可以在现有文件系统上分配一些空间用于ASM磁盘,过程如下所示:

mkdir -p /oracle/asmdisk

dd if=/dev/zero of=/oracle/asmdisk/disk1 bs=1024k count=1000

dd if=/dev/zero of=/oracle/asmdisk/disk2 bs=1024k count=1000

/sbin/losetup /dev/loop1 /oracle/asmdisk/disk1

/sbin/losetup /dev/loop2 /oracle/asmdisk/disk2

raw /dev/raw/raw1 /dev/loop1

raw /dev/raw/raw2 /dev/loop2

chmod 660 /dev/raw/raw1

chmod 660 /dev/raw/raw2

chown oracle:dba /dev/raw/raw1

chown oracle:dba /dev/raw/raw2

将以下内容添加到文件/etc/rc.local文件中:


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11766341.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存