UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

本文介绍如何在Oracle Linux 5和6中为Oracle Automatic Storage Manager (ASM)配置UDEV规则来确保磁盘的一致性和正确的所有权及权限。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6


For Oracle Automatic Storage Manager (ASM) to use disks, it needs to be able to identify the devices consistently and for them to have the correct ownership and permissions. In Linux you can use ASMLib to manage these tasks, but it is seen as an additional layer of complexity and has never really gained any popularity. Instead, many people use the Linux device manager "udev" to perform these tasks. This article presents a brief overview of setting up udev rules with respect to disks for use with ASM in Oracle 11g. The examples are all done using Oracle Linux 5 and 6, so they will be consistent with RHEL and CentOS 5 and 6.


Background
Identify the Disks (/sbin/scsi_id)
Make SCSI Devices Trusted
Create UDEV Rules File
Load Updated Block Device Partitions (/sbin/partprobe)
Test Rules (udevtest)
Restart UDEV Service
Check Ownership and Permissions
Background


Essentially, what udev does is apply rules defined in files in the "/etc/udev/rules.d" directory to the device nodes listed in the "/dev" directory. The rules can be defined in a variety of ways, but what we need to do is identify the device and say what we want udev to do with it.


In this case I know all my disk devices are named "/dev/sd?1", where the "?" represents a letter from a-d, so I can identify the devices of interest using the following rule parameters.


KERNEL=="sd?1", BUS=="scsi"
I want to tie each specific device to an alias, so it is always identified the same way, regardless of the device name Linux assigns it. So I need to be able to test each device that matches the previous pattern to see if it is the disk I am interested in. Each disk has a unique SCSI ID, so I can place a test into the rule, telling it how to perform the test, and the result it should return for a positive match. The following rule parameters explain how to test the device and what result constitutes a match in Oracle Linux 5.


PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
The scsi_id command works a little differently in Oracle Linux 6, so for that the following test works better.


PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
Once we have identified the specific device of interest, we need to indicate what actions should be performed on it. The following parameters specify an alias, the ownership and the permissions for the device.


NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
So the whole rule for each disk will look something like this in Oracle Linux 5.


KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
Or this in Oracle Linux 6.


KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
This means that the device pointing to the partition "sd*1" on the disk with the SCSI ID of "SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_" will always be called "/dev/asm-disk1", regardless of the letter "?" Linux assigns when the device is discovered. In addition, the device will have the correct ownership and permissions for ASM.


There are a number of wildcards and matching patterns that can be used if you don't want to write device-specific rules.


Now we know roughly what we are trying to achieve, we will look at each step necessary for setting up the disks for ASM to use.


Identify the Disks (/sbin/scsi_id)


We are going to write device-specific rules, so we need to be able to identify each device consistently, irrespective of the order in which Linux discovers it. To do this we are going to use the SCSI ID for each disk (not the partition), which we get using the scsi_id command. The "-s" option makes the paths relative to the "/sys" directory. For Oracle Linux 5, use the following command.


# /sbin/scsi_id -g -u -s /block/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /sbin/scsi_id -g -u -s /block/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -s /block/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -s /block/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_

The "-s" is not available in Oracle Linux 6, so you must use the following syntax.
# /sbin/scsi_id -g -u -d /dev/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /sbin/scsi_id -g -u -d /dev/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -d /dev/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -d /dev/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_

Make SCSI Devices Trusted


Add the following to the "/etc/scsi_id.config" file to configure SCSI devices as trusted.


options=-g
Create UDEV Rules File


Create the "/etc/udev/rules.d/99-oracle-asmdevices.rules" file.


# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
The file should contain the following lines for Oracle Linux 5. The PROGRAM parameter must match the command you used to retrieve the SCSI ID, and the RESULT parameter must match the value returned from your disks.


KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
The equivalent for Oracle Linux 6 is shown below.


KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
Load Updated Block Device Partitions (/sbin/partprobe)


Load updated block device partition tables.


# /sbin/partprobe /dev/sdb1
# /sbin/partprobe /dev/sdc1
# /sbin/partprobe /dev/sdd1
# /sbin/partprobe /dev/sde1
Test Rules (udevtest)


Test the rules are working as expected.


# udevtest /block/sdb/sdb1
# udevtest /block/sdc/sdc1
# udevtest /block/sdd/sdd1
# udevtest /block/sde/sde1
The output from the first disk should look something like this.


# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id -g -u -s /block/sdb/sdb1'
run_program: '/sbin/scsi_id' (stdout) 'SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdb1' becomes 'asm-disk1'
udev_device_event: device '/block/sdb/sdb1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/asm-disk1', major = '8', minor = '17', mode = '0660', uid = '1100', gid = '1200'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1' to '../../asm-disk1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1' to '../../asm-disk1'
main: run: 'socket:/org/kernel/dm/multipath_event'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/asm-disk1 /dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1 /dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1'
#
Restart UDEV Service


Restart the UDEV service.


# /sbin/udevcontrol reload_rules
# /sbin/start_udev
Check Ownership and Permissions


Check the disks are now available with the "asm-disk*" alias and the correct ownership and permissions.


# cd /dev
# ls -al asm-disk*
brw-rw---- 1 oracle dba 8, 17 Apr  8 22:47 asm-disk1
brw-rw---- 1 oracle dba 8, 33 Apr  8 22:47 asm-disk2
brw-rw---- 1 oracle dba 8, 49 Apr  8 22:47 asm-disk3
brw-rw---- 1 oracle dba 8, 65 Apr  8 22:47 asm-disk4
#
So the ASM_DISKSTRING initialization parameter in the ASM instance can be set to '/dev/asm-disk*' to identify the ASM disks.
<think>好的,我需要帮助用户在华为欧拉系统(EulerOS)上安装配置Oracle 11g RAC。首先,我得确认用户提到的几个引用内容,看看是否有相关的指导。引用1和2提到了一键安装Oracle 11GR2单机版的脚本,而引用3是关于安装Oracle 19C单机的。但用户需要的是RAC(Real Application Clusters),也就是集群环境,这与单机安装不同,步骤更复杂。 首先,用户的需求是安装Oracle 11g RAC在EulerOS上。根据现有的引用,虽然有一键安装单机版的脚本,但RAC需要更多的配置,比如共享存储、网络设置、集群软件等。可能需要结合官方文档和欧拉系统的兼容性来处理。 我需要先检查Oracle 11g RAC是否官方支持EulerOS。通常Oracle的认证系统会列出支持的操作系统版本。如果EulerOS不在列表中,可能需要使用兼容性配置,例如使用Red Hat或CentOS的兼容层。根据引用中的信息,用户成功安装了Oracle 11GR2和19C在EulerOS V2.0 SP9和openEuler 23.09上,这说明可能有社区或开发者已经做了适配,但RAC的具体步骤可能没有现成的脚本。 接下来,安装RAC的基本步骤应该包括:环境准备(网络配置、共享存储、用户权限等)、安装Grid Infrastructure、安装Oracle数据库软件、创建集群数据库等。需要详细说明每一步在EulerOS上的注意事项,比如内核参数调整、依赖包安装、可能遇到的兼容性问题。 此外,用户提供的引用中提到了使用一键安装脚本,但RAC安装无法完全自动化,需要手动配置网络和存储部分。可能需要指导用户如何修改现有的单机脚本,或者分步骤进行。 还需要注意EulerOS的版本差异,比如V2.0 SP9和openEuler 23.09可能有不同的库或工具链,需要确保安装步骤与系统版本兼容。同时,Oracle 11g RAC的版本是否支持这些系统,可能需要检查补丁版本,如引用3中的19C安装用了特定的补丁,类似地,11g可能需要应用某些补丁才能在EulerOS上运行。 最后,可能还需要指导用户如何处理常见问题,比如节点间通信问题、共享存储权限、集群服务启动失败等。此外,建议用户参考Oracle官方文档和社区经验,确保安装过程的正确性。</think>### EulerOS上安装Oracle 11g RAC的指导 #### **1. 环境准备** - **操作系统兼容性** Oracle 11g RAC官方未明确支持EulerOS,但可通过兼容Red Hat Enterprise Linux (RHEL)的方式实现。需确认EulerOS内核版本(如V2.0 SP9或openEuler 23.09)与Oracle 11g RAC的兼容性[^1][^2]。 - **硬件与网络要求** - 至少两个节点服务器,配置相同硬件。 - 共享存储(如ASM、NFS或iSCSI)。 - 私有网络(用于节点间通信)和公有网络(用于客户端连接),需配置静态IP和DNS解析。 - **依赖包安装** 安装必要的库文件(如`binutils`、`compat-libstdc++`等),可通过以下命令检查: ```bash rpm -q binutils compat-libstdc++-33 glibc ``` #### **2. 系统配置** - **内核参数调整** 修改`/etc/sysctl.conf`,设置以下参数: ```conf kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 ``` 执行`sysctl -p`生效。 - **用户与权限** 创建用户和组(如`oracle`、`dba`、`grid`),并配置资源限制: ```bash groupadd -g 1000 oinstall groupadd -g 1001 dba useradd -u 1000 -g oinstall -G dba oracle ``` #### **3. 共享存储配置** - **使用ASM(推荐)** 配置ASM磁盘组,确保所有节点均可访问共享存储设备。例如,通过UDEV规则绑定磁盘: ```bash /sbin/scsi_id -g -u /dev/sdb → 获取磁盘ID ``` 在`/etc/udev/rules.d/99-oracle-asmdevices.rules`中定义设备权限。 #### **4. 安装Grid Infrastructure** - **解压安装包并运行安装程序** ```bash unzip gridinfrastructure_11.2.0.4.0_linux64.zip ./grid/runInstaller ``` - 选择“Install and Configure Grid Infrastructure for a Cluster”。 - 配置SCAN名称和节点列表。 - 指定ASM磁盘组路径。 - **执行root脚本** 安装完成后,按提示在所有节点运行`root.sh`: ```bash /u01/app/oraInventory/orainstRoot.sh /u01/app/grid/root.sh ``` #### **5. 安装Oracle数据库软件** - **运行Database Installer** ```bash ./runInstaller ``` - 选择“Install database software only”。 - 配置集群节点和存储路径。 #### **6. 创建集群数据库** - 使用DBCA(Database Configuration Assistant)创建数据库: ```bash dbca -silent -createDatabase -templateName General_Purpose.dbc \ -gdbName racdb -sid rac -nodes node1,node2 -storageType ASM ``` #### **7. 验证集群状态** ```bash crsctl check cluster -all ``` --- ### **常见问题与优化** 1. **节点通信失败** 检查防火墙和`/etc/hosts`配置,确保私有网络互通[^1]。 2. **共享存储权限问题** 确保所有节点对ASM磁盘有相同权限(如使用UDEV规则固定设备名称)。 3. **性能调优** 调整ASM磁盘组冗余策略(如NORMAL冗余)和数据库参数(如`SGA_TARGET`)。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值