Oracle10g使用裸设备并绑定磁盘方法Raw Devices on Linux
Raw Devices on Oracle Linux and Red Hat Enterprise Linux
Verify that an appropriate raw devices utility (util-linux
) rpm is installed for the update of the operating systems. For example, on Oracle Linux 4 and Red Hat Enterprise Linux 4 (update 5), util-linux-2.12a-16.EL4.23.x86_64
or later rpm should be installed. On Oracle Linux 5 and Red Hat Enterprise Linux 5, util-linux-2.13-0.44.EL5.x86_64
or later rpm should be installed.
When you restart an Oracle Linux 4, Oracle Linux 5, Red Hat Enterprise Linux 4, or Red Hat Enterprise Linux 5 system, raw devices revert to their original owners and permissions by default. If you are using raw devices with this operating system for your Oracle files, for example, for ASM storage or Oracle Clusterware files, you need to override this default behavior. To do this, add an entry to the /etc/rc.d/rc.local
file for each raw device containing the chmod
and chown
commands required to reset them to the required values.
As an example, here are sample entries in a /etc/rc.d/rc.local
file that control the restart behavior of raw devices for two ASM disk files (/dev/raw/raw6
and /dev/raw/raw7
), two Oracle Cluster Registry files (/dev/raw/raw1
and /dev/raw/raw2
), and three Oracle Clusterware voting disks (/dev/raw/raw3
, /dev/raw/raw4
, and /dev/raw/raw5
):
# ASM chown oracle:dba /dev/raw/raw6 chown oracle:dba /dev/raw/raw7 chmod 660 /dev/raw/raw6 chmod 660 /dev/raw/raw7 # OCR chown root:oinstall /dev/raw/raw1 chown root:oinstall /dev/raw/raw2 chmod 660 /dev/raw/raw1 chmod 660 /dev/raw/raw2 # Voting Disks chown oracle:oinstall /dev/raw/raw3 chown oracle:oinstall /dev/raw/raw4 chown oracle:oinstall /dev/raw/raw5 chmod 644 /dev/raw/raw3 chmod 644 /dev/raw/raw4 chmod 644 /dev/raw/raw5
4.13 Oracle Clusterware Daemon Fails on Computer Restart
If different user IDs are used for installing Oracle Database 10g and Oracle Clusterware, then restarting the system results in OCR errors. Refer to the My Oracle Support(formerly OracleMetaLink) note 551478.1 for more information.
Workaround: Oracle recommends that you apply patch set 10.2.0.3 or higher to Oracle Clusterware installation before patching Oracle Database.
This issue is tracked with the Oracle bug 4748946.
4.14 Error When Installing Oracle Database 10g on Asianux Server 3
When installing Oracle Database 10g on Asianux Server 3, the Product Specific Prerequisite Checks screen reports that the operating system requirement checks fail.
Workaround: Change the contents of /etc/asianux
-release from Asianux Server 3 (Quartet) to Asianux release 3 (Quartet).
This issue is tracked with the Oracle bug 6457598.
4.15 Configuring Storages Devices for Oracle Clusterware on 2.6 Kernel Distributions
This section is for database and system administrators who intend to install or migrate to Oracle RAC 10g Release 2 (10.2) on Red Hat Enterprise Linux 5 or Oracle Linux 5 , and who need to configure raw devices for Oracle RAC and Oracle Clusterware. The Linux 2.6 kernel with these distributions requires additional configuration steps. The section contains the following topics:
4.15.1 Overview of Device Naming Persistence Changes
With the Linux 2.6 kernel, support for raw devices is deprecated. The preferred way to access block devices is direct input/output to the devices using O_DIRECT
. Therefore, /etc/sysconfig/rawdevices
files of Red Hat Enterprise Linux 4 and Oracle Linux 4, and /etc/udev/rules.d/60-raw.rules
files of Red Hat Enterprise Linux 5 and Oracle Linux 5 are deprecated. For details, refer to the Linux documentation for your 2.6 kernel.
The 2.4 kernel device file naming scheme devlabel
maintained persistent device file names between server restarts. By default, the 2.6 kernel device file naming scheme udev
dynamically creates device file names when the server is started, and assigns ownership of them to root
. If udev
applies default settings, then it changes device file names and owners for voting disks or Oracle Cluster Registry partitions, corrupting them when the server is restarted. For example, a voting disk on a device named /dev/sdd
owned by the user crs
may be on a device named /dev/sdf
owned by root
after restarting the server.
To prevent corruption, you need to create a custom rules file. When udev
is started, it sequentially carries out rules (configuration directives) defined in rule files. These files are in the path /etc/udev/rules.d/
. Rules files are read in lexical order. For example, rules in file 10-wacom.rules
are parsed and carried out before rules in rule file 90-ib.rules
. Where rules files describe the same devices, on Asianux, Red Hat, and Oracle Linux, the last file read is the one that is applied. (On SUSE 2.6 kernels, it is the first file read).
4.15.2 Configuring Raw Devices for Clusterware on Red Hat and Oracle Linux 5
This section contains the following topics:
Configure SCSI_ID to Return Unique Device Identifiers
Before you can configure udev
to name devices, you must first configure scsi_id
to return device identifiers, and then ensure that these devices are visible and accessible on all cluster nodes. To do this, complete the following task:
Modify the
/etc/scsi_id.config
file by adding or replacing the 'option=-b' parameter/value pair (if it exists) with 'option=-g'. For example:# cd /etc # cp scsi_id.config scsi_id.config.orig # grep -v ^# /etc/scsi_id.config vendor="ATA",options=-p 0x80 options=-g
Run the command
fdisk
(/sbin/fdisk
) to ensure that Clusterware devices are visible. For example:# /sbin/fdisk -l /dev/sdb1 /dev/sde1 Disk /dev/sdb1: 261 MB, 261890048 bytes 9 heads, 56 sectors/track, 1014 cylinders Units = cylinders of 504 * 512 = 258048 bytes Disk /dev/sdb1 does not contain a valid partition table Disk /dev/sde1: 52 MB, 52403200 bytes 2 heads, 50 sectors/track, 1023 cylinders Units = cylinders of 100 * 512 = 51200 bytes Disk /dev/sde1 does not contain a valid partition table
In some cases, to see newly provisioned or modified) devices on shared storage, you may need to update cluster node operating systems. Do this either by restarting the nodes, or by using commands such as
/sbin/partprobe
device
, orsfdisk -r
device
. Resolve any issues preventing cluster nodes from correctly seeing or accessing storage devices you intend to use for Clusterware files before proceeding.Note:
At this point, cluster nodes may refer to the devices using different device file names. This is expected.Run the command
scsi_id
(/sbin/scsi_id
) on storage devices from one cluster node to obtain their unique device identifiers. When running thescsi_id
command with the-s
argument, the device path and name passed should be that relative to thesysfs
directory/sys
(for example,/block/
device
) when referring to/sys/block/
device. For example:# /sbin/scsi_id -g -s /block/sdb/sdb1 360a98000686f6959684a453333524174 # /sbin/scsi_id -g -s /block/sde/sde1 360a98000686f6959684a453333524179
Record the unique SCSI identifiers of Clusterware devices, so you can provide them when required in the following section, "Configure Udev for Persistent Naming of Oracle Clusterware Devices."
Note:
The commandscsi_id
should return the same device identifier value for a given device, regardless of which node the command is run from.
Configure Udev for Persistent Naming of Oracle Clusterware Devices
Configure persistent user-defined naming of Oracle Clusterware device file names in a udev rules file. This step is optional, but recommended.
The default rule files affecting storage devices are rule files 50 and 51. So, create a custom rules file using the format [number]-[name][.rules] with a number value greater than 51 to ensure that the device settings you provide are the ones applied. For example:
55-oracle-naming.rules
To do this, complete the following tasks:
Create a custom
udev
device naming rule file. For example:# touch /etc/udev/rules.d/55-oracle-naming.rules
Use a text editor such as
vi
, add to the custom device naming rule file the device-matching rules for the storage devices you intend to use with Oracle Clusterware, matching them to the unique SCSI identifiers you determined in the preceding section. For example:# Configure persistent, user-defined Oracle Clusterware device file names KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000686f6959684a453333524174", NAME="ocr1", OWNER="root", GROUP="oinstall", MODE="0640" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000686f6959684a453333524179", NAME="vote1", OWNER="oracle", GROUP="oinstall", MODE="0640"
For each rule, if all specified keys (KERNEL, BUS, PROGRAM, RESULT) are matched, then the rule is applied and the specified assignments (NAME, OWNER, GROUP, MODE) are assigned to the device file name. However, if one or more keys are unmatched, then the rule is completely ignored and the default (arbitrary) kernel-assigned device file names are assigned to devices.
Note:
In the example rules files shown, Oracle Clusterware devices are created with oraInventory group (oinstall
). Oracle recommends that you create these devices to ensure that Cluster Verification Utility can be run during installation.Run the command
udevtest
(/sbin/udevtest
) to test theudev
rules configuration you have created. The output should indicate that the block devices are available and the rules are applied as expected. For example:# udevtest /block/sdb/sdb1 main: looking at device '/block/sdb/sdb1' from subsystem 'block' udev_rules_get_name: add symlink 'disk/by-id/scsi-360a98000686f6959684a453333524174-part1' udev_rules_get_name: add symlink 'disk/by-path/ip-192.168.1.1:3260-iscsi-iqn.1992-08.com.netapp:sn.887085-part1' udev_node_mknod: preserve file '/dev/.tmp-8-17', because it has correct dev_t 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' run_program: '/sbin/scsi_id' (stdout) '360a98000686f6959684a453333524174' run_program: '/sbin/scsi_id' returned with status 0 udev_rules_get_name: rule applied, 'sdb1' becomes 'ocr1' udev_device_event: device '/block/sdb/sdb1' validate currently present symlinks udev_node_add: creating device node '/dev/ocr1', major = '8', minor = '17', mode = '0640', uid = '0', gid = '500' udev_node_add: creating symlink '/dev/disk/by-id/scsi-360a98000686f6959684a453333524174-part1' to '../../ocr1' udev_node_add: creating symlink '/dev/disk/by-path/ip-192.168.1.1:3260-iscsi-iqn.1992-08.com.netapp:sn.84187085 -part1' to '../../ocr1' 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/ocr1 /dev/disk/by-id/scsi-360a98000686f6959684a453333524174-part1 /dev/disk/by-path/ip-192.168.1.1:3260-iscsi-iqn.1992-08.com.netapp:sn.84187085- part1'
In the example output, note that applying the rules renames OCR device
/dev/sdb1
to/dev/ocr1
.Restart the
udev
service by running the commandstart_udev
(/sbin/start_udev
). Restartingudev
applies theudev
rules to the devices, including the device file rules you have created. Use the commandls -l
command to ensure that the rules file has applied the new device names the rules file has applied. For example:# start_udev # ls -l /dev | grep -e 'ocr1\|vote1' brw-r----- 1 root oinstall 8, 17 Oct 29 15:31 ocr1 brw-rw---- 1 oracle oinstall 8, 65 Oct 29 15:31 vote1
Bind Raw Devices Using Udev
Perform the following steps to bind raw devices using the udev device manager:
If the file
/etc/udev/rules.d/60-raw.rules
does not exist, then create it. If it does exist, then create a rules file for raw devices used with Oracle installations. For example:# touch /etc/udev/rules.d/60-raw.rules
or
# touch /etc/udev/rules.d/61-oracleraw.rules
Add the
udev
raw binding rules to the raw devices rules file you created. For example:vi /etc/udev/rules.d/61-oracleraw.rules # Raw bind to Oracle Clusterware devices ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000686f6959684a453333524174", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000686f6959684a453333524179", RUN+="/bin/raw /dev/raw/raw2 %N" t 29 15:31 vote1
Create a
udev
raw permissions file/etc/udev/rules.d/65-raw-permissions.rule
s. For example:# touch /etc/udev/rules.d/65-raw-permissions.rules
Using a text editor, add the
udev
raw permission rules to the file/etc/udev/rules.d/65-raw-permissions.rules
. For example:# Set permissions of raw bindings to Oracle Clusterware devices KERNEL=="raw1", OWNER="root", GROUP="oinstall", MODE="640" KERNEL=="raw2", OWNER="oracle", GROUP="oinstall", MODE="640"
Test the
udev
rules by running theudevtest
command (/sbin/udevtest
) again to ensure that the rules are applied, and that they create proper permissions for Oracle Clusterware devices. For example:# udevtest /block/sdb/sdb1 main: looking at device '/block/sdb/sdb1' from subsystem 'block' udev_rules_get_name: add symlink 'disk/by-id/scsi-360a98000686f69 59684a453333524174-part1' udev_rules_get_name: add symlink 'disk/by-path/ip-192.168.1.1:3260 -iscsi-iqn.1992-08.com.netapp:sn.84187085-part1' udev_node_mknod: preserve file '/dev/.tmp-8-17', because it has correct dev_t 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' run_program: '/sbin/scsi_id' (stdout) '360a98000686f6959684a45333 3524174' run_program: '/sbin/scsi_id' returned with status 0 udev_rules_get_name: rule applied, 'sdb1' becomes 'ocr1' udev_device_event: device '/block/sdb/sdb1' validate currently present symlinks udev_node_add: creating device node '/dev/ocr1', major = '8', minor = '17', mode = '0640', uid = '0', gid = '500' udev_node_add: creating symlink '/dev/disk/by-id/scsi-360a9800068 6f6959684a453333524174-part1' to '../../ocr1' udev_node_add: creating symlink '/dev/disk/by-path/ip-192.168.1.1 :3260-iscsi-iqn.1992-08.com.netapp:sn.84187085-part1' to '../../ocr1' 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/ocr1 /dev/disk/by-id/scsi-36 0a98000686f6959684a453333524174-part1 /dev/disk/by-path/ip-192.168.1. 1:3260-iscsi-iqn.1992-08.com.netapp:sn.84187085-part1' main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'
Restart
udev
to implement the rules you have created and tested. For example:# start_udev
目录 返回
首页