【ASM】ASMLIB 系列
说明:RHEL6、
RHEL7、CentOS6、CentOS7 都可以使用asmlib,只不过需要安装kmod-oracleasm包。
RHEL5不需要安装
kmod-oracleasm包
。
下载地址可直接在官网搜索:www.oracle.com
---------------------------- oracleasm常用命令 asmlib oracleasm日志: tail -f /var/log/oracleasm
/usr/sbin/oracleasm configure -i
/usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm restart
/etc/init.d/oracleasm status
/etc/init.d/oracleasm init
/usr/sbin/oracleasm enable
/usr/sbin/oracleasm restart
/usr/sbin/oracleasm createdisk DISKNAME devicename
/usr/sbin/oracleasm deletedisk DISKNAME
/usr/sbin/oracleasm querydisk {DISKNAME | devicename}
/usr/sbin/oracleasm listdisks
/usr/sbin/oracleasm scandisks
ls -l /dev/oracleasm/disks
--asmlib配置文件
cat /etc/sysconfig/oracleasm
oracleasm configure
oracleasm日志: tail -f /var/log/oracleasm
安装:
## 先安装kmod-oracleasm,再安装oracleasmlib和oracleasm-support
--------------- rhel6.5安装asmlib:https://www.oracle.com/search
yum install -y kmod-oracleasm
# http://rpmfind.net/linux/rpm2html/search.php
# wget http://rpmfind.net/linux/centos/6.10/updates/x86_64/Packages/kmod-oracleasm-2.0.8-16.1.el6_10.x86_64.rpm
下载:https://www.oracle.com/linux/downloads/linux-asmlib-rhel6-downloads.html
wget https://oss.oracle.com/projects/oracleasm-support/dist/files/RPMS/rhel6/amd64/2.1.8/oracleasm-support-2.1.8-1.el6.x86_64.rpm
wget https://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
rpm -ivh *.rpm
oracleasm configure -i # grid,asmadmin,y,y
oracleasm configure -d
oracleasm configure -e
oracleasm init
oracleasm status
fdisk -l | grep dev
oracleasm createdisk ocr01 /dev/vdb1
oracleasm listdisks
oracleasm renamedisk -f /dev/sdf1 asmdisk3
https://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
--------------- rhel7安装asmlib:https://www.oracle.com/search
yum install -y kmod-oracleasm
# http://rpmfind.net/linux/rpm2html/search.php
# wget http://rpmfind.net/linux/centos/7.7.1908/os/x86_64/Packages/kmod-oracleasm-2.0.8-26.el7.x86_64.rpm
下载:https://www.oracle.com/linux/downloads/linux-asmlib-rhel7-downloads.html
wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracleasm-support-2.1.11-2.el7.x86_64.rpm
wget https://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el7.x86_64.rpm
rpm -ivh *.rpm
systemctl enable oracleasm.service
oracleasm configure -i # grid,asmadmin,y,y
oracleasm configure -d
oracleasm configure -e
oracleasm init
oracleasm status
fdisk -l | grep dev
oracleasm createdisk ocr01 /dev/vdb1
oracleasm listdisks
oracleasm renamedisk -f /dev/sdf1 asmdisk3
------ ASM磁盘
$ORACLE_HOME/bin/kfod disk=asm s=true ds=true c=true
/grid/stage/ext/bin/kfod disk=asm s=true ds=true c=true
# 18c
kfod disks=asm ds=true cluster=true
create diskgroup DATA external redundancy disk '/dev/raw/raw*';
create diskgroup FRA external redundancy disk '/dev/rhdisk3'; --创建磁盘组FRA
CREATE DISKGROUP ACFSDG external redundancy DISK '/dev/oracleasm/disks/VOL1' ATTRIBUTE 'compatible.asm' = '11.2','compatible.rdbms' = '11.2','compatible.advm'='11.2';
create diskgroup OCR external redundancy disk 'ORCL:OVDISK' attribute 'compatible.asm'='11.2','compatible.rdbms'='11.2';
CREATE DISKGROUP dgroup1 NORMAL REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7';
CREATE DISKGROUP dgroup1 HIGH REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7', '/dev/raw/raw8';
create diskgroup DG1 external redundancy
failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1
failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2;
create diskgroup DG2 normal redundancy
failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1
failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2;
create diskgroup DG2 normal redundancy
failgroup FG1 disk '/dev/raw/raw6','/dev/raw/raw7' name DG2_FG1_VOL1
failgroup FG2 disk '/dev/raw/raw8','/dev/raw/raw9' name DG2_FG2_VOL2;
---修改磁盘组的兼容属性
ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.asm' = '11.1';
ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.rdbms' = '11.1';
COLUMN name FORMAT A10
COLUMN compatibility FORMAT A20
COLUMN database_compatibility FORMAT A20
SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;
set line 9999
set pagesize 9999
col path format a60
SELECT a.group_number, disk_number,mount_status, a.name, path FROM v$asm_disk a order by a.disk_number;
select instance_name,status from v$instance;
set line 999
select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number, disk_number,mount_status, path from v$asm_diskgroup a;
select a.group_number,name,TYPE,state,TOTAL_MB,free_mb from v$asm_diskgroup a;
select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number from v$asm_diskgroup a;
alter diskgroup DG1 mount;
---nomount状态下强制删除磁盘组
drop diskgroup oradg force including contents;
alter diskgroup DG1 drop disk DG1_VOL5; --删除磁盘组DG1中的磁盘VOL5
alter system set asm_diskstring='','ORCL:*','/dev/raw/raw*','/dev/oracleasm/disks/VOL*';
alter system set asm_diskstring='/dev/asm-disk*','/dev/raw/raw*';
alter diskgroup DATA add disk '/dev/raw/raw1';
export GRID_HOME=$ORACLE_HOME
# 查询ASM磁盘
$GRID_HOME/bin/kfod disks=asm st=true ds=true cluster=true
# /grid/stage/ext/bin/kfod disks=asm st=true ds=true cluster=true
------------------------ faking asmdisk asm磁盘
---- 添加loop设备个数
第一种办法:修改 /etc/modprobe.conf 文件添加参数:options loop max_loop=20 可以通过 modprobe -v loop 命令立即加载该模块,或重启
第二种办法(通用):mknod -m 0660 /dev/loopX b 7 X
raw -qa
losetup -a
--mknod -m 0660 /dev/loopX b 7 X
mknod -m 0660 /dev/loop9 b 7 9
mkdir /asmdisk
dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk4 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk5 bs=1024k count=2000
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
/sbin/losetup /dev/loop4 /asmdisk/disk4
/sbin/losetup /dev/loop5 /asmdisk/disk5
raw /dev/raw/raw1 /dev/loop1
raw /dev/raw/raw2 /dev/loop2
raw /dev/raw/raw3 /dev/loop3
raw /dev/raw/raw4 /dev/loop4
raw /dev/raw/raw5 /dev/loop5
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
chmod 660 /dev/raw/raw3
chmod 660 /dev/raw/raw4
chmod 660 /dev/raw/raw5
chown oracle:dba /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chown oracle:dba /dev/raw/raw3
chown oracle:dba /dev/raw/raw4
chown oracle:dba /dev/raw/raw5
------ 将以下内容添加到文件/etc/rc.local文件中
------Add the following entries to the file "/etc/rc.local"
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
/sbin/losetup /dev/loop4 /asmdisk/disk4
/sbin/losetup /dev/loop5 /asmdisk/disk5
raw /dev/raw/raw1 /dev/loop1
raw /dev/raw/raw2 /dev/loop2
raw /dev/raw/raw3 /dev/loop3
raw /dev/raw/raw4 /dev/loop4
raw /dev/raw/raw5 /dev/loop5
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
chmod 660 /dev/raw/raw3
chmod 660 /dev/raw/raw4
chmod 660 /dev/raw/raw5
chown grid:asmadmin /dev/raw/raw1
chown grid:asmadmin /dev/raw/raw2
chown grid:asmadmin /dev/raw/raw3
chown grid:asmadmin /dev/raw/raw4
chown grid:asmadmin /dev/raw/raw5
------------------------ Simulating Asm by faking hardware
-->Faking Hardware
-->Instaling ASM Lib
-->Configuring the disks
-->Install DB & ASM instance
---Faking Hardware: root 用户
mkdir /asmdisk
dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /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 grid:asmadmin /dev/raw/raw1
chown grid:asmadmin /dev/raw/raw2
------Add the following entries to the file "/etc/rc.local"
echo "/sbin/losetup /dev/loop1 /asmdisk/disk1" >>/etc/rc.local
echo "/sbin/losetup /dev/loop2 /asmdisk/disk2" >>/etc/rc.local
faking出来的磁盘也可以用于ASMLIB
# mknod -m 0660 /dev/loop3 b 7 3
# losetup -d loop1 #删除loop设备
losetup -a
mkdir /asmdisk
dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
oracleasm createdisk ASM1 /dev/loop1
oracleasm createdisk ASM2 /dev/loop2
oracleasm createdisk ASM3 /dev/loop3
----以下内容加入到/etc/rc.local
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
oracleasm scandisks
# linux7下需要执行chmod +x /etc/rc.d/rc.local
使用ASMLIB管理磁盘
在存储管理员给服务器提供磁盘设备后,它们对于服务器来说是可用的并且可以在Linux系统中 的/proc/partitions虚拟文件中可以看到。系统管理然后使用Linux fdisk工具来对磁盘设备进行分 区。被分区后磁盘设备现在可以被配置为ASMLIB磁盘,系统管理员创建ASMLIB磁盘。创建命 令:oracleasm createdisk。createdisk命令使用两个输入参数,通过设备来生成用户定义的磁盘名:
[root@racnode1]#/etc/init.d/oracleasm createdisk VOL1 /dev/sdg1
Creating Oracle ASM disk "VOL1" [ OK ]
磁盘名被限制为30个字符。它们必须使用字母开头但可以由其它ASCII字符组成,包括:大写字母, 数字和下划线。每一个被创建成功的磁盘被标识为ASMLIB磁盘并且会被显示在oracleasm文件系统 中/dev/oracleasm/disks/。文件系统是一种特定的不受任何方式进行维护。
用户可查询磁盘设备来判断是否它们是有效的ASMLIB磁盘。为了查询,使用下面的oracleasm querydisk命令。querydisk命令可以应用于裸设备和ASMLIB磁盘
[root@racnode1]#/etc/init.d/oracleasm querydisk /dev/sdg1
Checking if device "/dev/sdg" is an Oracle ASM disk [ OK ]
[root@racnode1]#/etc/init.d/oracleasm querydisk VOL1
Checking for ASM disk "VOL1" [ OK ]
另外,所有被标记的磁盘与使用ASMLIB创建的磁盘可以使用以下oracleasm listdisks命令来显示:
[root@racnode1]#/etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
如果一个磁盘设备不是一个ASMLIB磁盘,会显示以下信息:
[root@racnode1]#/etc/init.d/oracleasm querydisk /dev/sdh1
Checking if device "/dev/sdh1" is an Oracle ASM disk [FAILED]
对于ASM不再需要的磁盘可以撤消标记并且使用oracleasm deletedisk命令来删除:
[root@racnode1]#/etc/init.d/oracleasm deletedisk VOL1
Deleting Oracle ASM disk "VOL1" [ OK ]
当ASMLIB用于RAC环境时,对于RAC的共享磁盘架构允许使用oracleasm createdisk命令只在一个节点 上创建ASMLIB磁盘,其它节点只需要使用ASMLIB扫描来查找ASMLIB磁盘就可以了。例如,对于两节点 RAC环境,节点1可以标记ASMLIB磁盘,节点2然后执行扫描ASMLIB磁盘来查找这些ASMLIB磁盘。
[root@racnode1]#/etc/init.d/oracleasm createdisk VOL1 /dev/sdg1
Creating Oracle ASM disk "VOL1" [ OK ]
[root@racnode2]#/etc/init.d/oracleasm scandisks
Scanning system for ASM disks [ OK ]
在合适的ASMLIB磁盘创建后,ASM的init.ora参数asm_diskstring可以保留缺省的NULL或者设置 为'ORCL:*'。一旦设置后,ASM将可以发现以下磁盘:
SQL> select name, library, path from v$asm_disk;
NAME LIBRARY PATH
----------- ------------------------- -------------------------
VOL1 ASM Library Generic Linux ORCL:VOL1
VOL2 ASM Library Generic Linux ORCL:VOL2
VOL3 ASM Library Generic Linux ORCL:VOL3
注意,如果ASMLIB没有使用,那么上面的查询LIBRARY列将返回"System"。
重命名Disk
renamedisk命令被用来改变现有成员的标签而不会丢失数据。注意修改磁盘时只有当ASM不访问该磁 盘才行。因此磁盘组必须dismount,并且在RAC环境中,所有ASM节点必须都dismount磁盘组。当有 ASM实例访问被重新标签的磁盘时执行renamedisk操作可能造成损坏。因为renamedisk命令是危险的 通过打印消息可以看到:
[root@racnode1]#/etc/init.d/oracleasm renamedisk /dev/sdb3 VOL1
Warning: Changing the label of a disk marked for ASM is a very
dangerous operation. If this is really what you mean to do, you
must ensure that all Oracle and ASM instances have ceased using
this disk. Otherwise, you may LOSE DATA. If you really wish to
change the label, rerun with the force-renamedisk command.
[root@racnode1]#/etc/init.d/oracleasm force-renamedisk /dev/sdb3 VOL1
Renaming disk "/dev/sdb3" to "VOL1" [ OK ]
force_renamedisk命令使用两个参数:裸设备名,其次是ASM磁盘名。
discover磁盘
命令/sbin/oracleasm-discover是一个简单的工具来判断Oracle的Linux ASMLIB在discover操作时所看到那个磁盘。这个命令更多一个调试工具来验证discover所列出的请求磁盘。这个命令也列出了每个磁盘的最大I/O大小。最大I/O大小,ASMLIB可以作为一个命令发送给设备。
[root@racnode1]#/usr/sbin/oracleasm-discover 'ORCL:*'
Using ASMLib from /opt/oracle/extapi/32/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.0 (KABI_V1)]
Discovered disk: ORCL:VOL1 [819200 blocks (419430400 bytes), maxio 512]
Discovered disk: ORCL:VOL2 [1955808 blocks (1001373696 bytes), maxio 512]
最大I/O大小来自SCSI HBA设备与磁盘设备链中的其它设备。在上面的例子中,maxio等于512,512 byte或256K。如果maxio显示了最小值,比如128,那么它可能是中间组件比如多路径设备或HBA设备限制的原因。
升级ASMLIB
为了升级ASMLIB,系统管理员可以执行以下步骤。注意这是严格意义上的软件升级并且没有磁盘标签 被维护。这是一个节点本地升级,因此在RAC环境中,每个单独的节点应该被升级。
1.关闭ASM
2.执行/etc/init.d/oracleasm stop
3.执行rpm -Uvh oracleasm-*.rpm
4.执行/etc/init.d/oracleasm start
5.启动ASM
诊断ASMLIB
诊断ASMLIB从上到下的操作步骤为:
1.使用的Oracle ASMLIB的当前版本。验证软件版本。ASMLIB请求一个设备精确匹配给内核,因此使 用与uname -a命令输出匹配的oracleasm内核包。
[root@racnode1]# rpm -qa |grep oracleasm
oracleasm-support-2.0.3-1.i386.rpm
oracleasmlib-2.0.2-1.i386.rpm
oracleasm-2.6.9-42.0.3.ELsmp-2.0.3-1.i686.rpm
[root@racnode1]# uname -a
Linux racnode1.us.oracle.com 2.6.9-42.0.3.ELsmp #1Thu May 15
17:03:45 EST 2006 i686 i686 i386 GNU/Linux
2.验证ASMLIB的安装设置
3.确保oracleasm configure命令正确运行,使用以下信息进行确认配置:
a.以root用户执行lsmod命令来显示加载的oracleasm模块。使用oracleasm模块"Used by"列会被设 置为1.
[root@db2 ~]# lsmod
Module Size Used by
oracleasm 53591 1
8021q 20994 0
garp 7297 1 8021q
stp 2256 1 garp
llc 5608 2 garp,stp
cpufreq_ondemand 9398 80
ip6t_REJECT 4486 2
nf_conntrack_ipv6 10595 3
nf_defrag_ipv6 11368 1 nf_conntrack_ipv6
xt_state 1370 3
nf_conntrack 84658 2 nf_conntrack_ipv6,xt_state
ip6table_filter 1671 1
ip6_tables 19409 1 ip6table_filter
ipv6 339024 660 ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6
dm_round_robin 2531 34
dm_multipath 18562 18 dm_round_robin
uinput 8917 0
sg 30968 0
serio_raw 5631 0
iTCO_wdt 6353 0
iTCO_vendor_support 3030 1 iTCO_wdt
coretemp 6997 0
acpi_cpufreq 13345 0
freq_table 6987 2 cpufreq_ondemand,acpi_cpufreq
mperf 1555 1 acpi_cpufreq
intel_powerclamp 10841 0
kvm_intel 130025 0
kvm 438077 1 kvm_intel
crc32c_intel 14496 0
ghash_clmulni_intel 4707 0
microcode 115607 0
pcspkr 2150 0
igb 186225 0
hwmon 2087 2 coretemp,igb
i2c_i801 12911 0
i2c_core 31228 1 i2c_i801
lpc_ich 12496 0
mfd_core 3955 1 lpc_ich
ioatdma 61937 168
dca 7283 2 igb,ioatdma
i7core_edac 20072 0
edac_core 54168 1 i7core_edac
shpchp 27901 0
ext4 532546 2
jbd2 100769 1 ext4
mbcache 7575 1 ext4
sd_mod 41045 38
crc_t10dif 1547 1 sd_mod
qla2xxx 562439 68
scsi_transport_fc 54538 1 qla2xxx
scsi_tgt 12075 1 scsi_transport_fc
sr_mod 15980 0
cdrom 40900 1 sr_mod
usb_storage 53806 0
megaraid_sas 101114 3
aesni_intel 45744 0
ablk_helper 2997 1 aesni_intel
cryptd 10460 3 ghash_clmulni_intel,aesni_intel,ablk_helper
lrw 4222 1 aesni_intel
aes_x86_64 7967 1 aesni_intel
xts 3466 1 aesni_intel
gf128mul 7999 2 lrw,xts
pata_acpi 3782 0
ata_generic 3758 0
ata_piix 26525 0
dm_mirror 14208 0
dm_region_hash 11094 1 dm_mirror
dm_log 9681 2 dm_mirror,dm_region_hash
dm_mod 85047 41 dm_multipath,dm_mirror,dm_log
b.执行命令cat /proc/filesystem,并且确保在文件系统列表中存在一条名叫oracleasmfs的记录:
[root@db2 ~]# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev cpuset
nodev tmpfs
nodev devtmpfs
nodev binfmt_misc
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev devpts
nodev ramfs
nodev hugetlbfs
iso9660
nodev pstore
nodev mqueue
ext4
nodev asmdisk
nodev oracleasmfs
c.执行命令 df -ha,它将显示所mount的oracleasmfs
/dev/mapper/vg_db2-LogVol00
1.1T 437G 592G 43% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
tmpfs 126G 1005M 125G 1% /dev/shm
/dev/sda1 190M 79M 98M 45% /boot
none 0 0 0 - /proc/sys/fs/binfmt_misc
oracleasmfs 0 0 0 - /dev/oracleasm
确保oracleasm createdisk正确执行。为了让ASM使用,磁盘被通过createdisk命令来标记。当磁盘被标记后,会在磁盘头中写入签名--,磁盘将被标记ASM使用。可以使用以下命令来验证.执行oracleasm listdisks命令。这个命令将显示被标记为ASMLIB的磁盘。
[root@db2 ~]# oracleasm listdisks
ARCH0
ARCH1
ARCH2
ARCH3
CW_DATA1
OCR1
OCR2
OCR3
RLZY_ARCH1
RLZY_DATA1
RLZY_DATA2
RLZY_DATA3
SBK_DATA0
SBK_DATA1
SBK_DATA2
YB_DATA4
YB_DATA5
.对每个被标记为ASMLIB磁盘执行oracleasm querydisk命令来确保标记
[root@db2 ~]# oracleasm querydisk YB_DATA4
Disk "YB_DATA4" is a valid ASM disk
4.执行ls -l /dev/oracleasm/disks来确保磁盘的所属组与权限是grid:asmadmin
[root@db2 ~]# ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 grid asmadmin 252, 8 Dec 7 20:14 ARCH0
brw-rw---- 1 grid asmadmin 252, 9 Dec 7 20:17 ARCH1
brw-rw---- 1 grid asmadmin 252, 10 Dec 7 20:18 ARCH2
brw-rw---- 1 grid asmadmin 252, 11 Dec 7 20:18 ARCH3
brw-rw---- 1 grid asmadmin 252, 14 Dec 7 20:18 CW_DATA1
brw-rw---- 1 grid asmadmin 252, 1 Dec 7 20:18 OCR1
brw-rw---- 1 grid asmadmin 252, 2 Dec 7 20:18 OCR2
brw-rw---- 1 grid asmadmin 252, 6 Dec 7 20:18 OCR3
brw-rw---- 1 grid asmadmin 252, 7 Dec 7 20:18 RLZY_ARCH1
brw-rw---- 1 grid asmadmin 252, 3 Dec 7 20:18 RLZY_DATA1
brw-rw---- 1 grid asmadmin 252, 4 Dec 7 20:18 RLZY_DATA2
brw-rw---- 1 grid asmadmin 252, 5 Dec 7 20:18 RLZY_DATA3
brw-rw---- 1 grid asmadmin 252, 15 Dec 7 20:18 SBK_DATA0
brw-rw---- 1 grid asmadmin 252, 16 Dec 7 20:18 SBK_DATA1
brw-rw---- 1 grid asmadmin 252, 17 Dec 7 20:18 SBK_DATA2
brw-rw---- 1 grid asmadmin 252, 12 Dec 7 20:18 YB_DATA4
brw-rw---- 1 grid asmadmin 252, 13 Dec 7 20:18 YB_DATA5
5.验证ASMLIB发现字符串(可以在DBCA中指定或设置asm_diskstring参数)是否被设置ORCL:*或NULL。 如果ASM实例在运行,那么检查ASM的alert log查看是否正确设置。
6.对ASM alert log中关于发现所显示的任何信息使用Linux/Unix的grep命令。如果成功加载ASMLIB 将会显示以下信息:
Loaded ASM Library - Generic Linux, version 2.0.1 library for
ASMLIB interface
下面的查询显示被发现的ASMLIB磁盘:
SQL> SELECT LIBRARY, PATH FROM V$ASM_DISK;
LIBRARY PATH
------------------------------------------- ----------------
ASM Library - Generic Linux, version 2.0.0.1 ORCL:VOL1
ASM Library - Generic Linux, version 2.0.0.1 ORCL:VOL2
ASM Library - Generic Linux, version 2.0.0.1 ORCL:VOL3
如果在Library列显示system,那么asm_diskstring没有设备--,ASMLIB不能用于访问磁盘。ASMLIB 需要通过磁盘符ORCL:*来访问磁盘。检查asm_diskstring是否设置为ORCL:*或NULL:
SQL> SELECT LIBRARY, PATH FROM V$ASM_DISK;
LIBRARY PATH
-------------- -------------------------------------------------
System /dev/oracleasm/disks/DATA1D1
System /dev/oracleasm/disks/DATA1D2
System /dev/oracleasm/disks/DATA1D3
7.查看ASM alert log中是否有以下错误信息:
ORA-15186: ASMLIB error function = [asm_open], error = [1],mesg = [Operation not permitted]
这个消息通常意味着在/etc/init.d/oracleasm configure操作时ASMLIB配置权限不正确
迁移到ASMLIB
在许多情况下可能需要将一个"member"ASM裸磁盘转换为一个ASMLIB磁盘。例如,当安装ASMLIB后需 要执行。相反,如果需要卸载ASMLIB,可以将一个ASMLIB磁盘转换为一个标准的ASM磁盘。所有这种操 作不会损坏磁盘上的数据。然而,在转换之前必须将磁盘组dismount。
这种转换不会损坏数据因为磁盘上的结构和磁盘打开ASM所读取的信息。ASM读取磁盘头并且识别它属 于那个磁盘组。当一个磁盘被增加到一个磁盘组时,ASM将对磁盘写入一些信息。两个重要的条目是 磁盘标记与ASMLIB标签。所有ASM磁盘有一个标记ORCLSDISK印记在磁盘上面。如果标记已经存在,那 么磁盘可以当前被使用或者被ASM格式化了。这个标记可以由ASM或ASMLIB所创建。例如,当ASM在创 建磁盘组时使用一个磁盘作为一个裸设备时,ASM会自动增加这个标记。相反,当通过ASMLIB命 令/etc/init.d/oracleasm createdisk命令时磁盘会增加ASMLIB标记。不管使用那种工具创建标记, 一旦标记被创建,磁盘就会被打上标签。
磁盘头的第二部分与ASMLIB相关,是ASMLIB标签。这是指派给ASMLIB用来标识磁盘的24个字符的字符 串。当通过ASMLIB的/etc/init.d/oracleasm createdisk命令来配置磁盘时,相关的标签会被写入设备。注意ASM会保存磁盘的内容,但写入这部分信息是留给ASMLIB。
下面是一个对ASM磁盘(不是ASMLIB)的一个简单dump,这个磁盘被加入一个磁盘。在磁盘头中的ASM磁 盘名为DATA_0003:
[root@db2 ~]# dd if=/dev/mapper/yb_data4 bs=128 count=1 | od -a
1+0 records in
1+0 records out
0000000 soh stx soh soh nul nul nul nul etx nul nul nul K eot [ l
128 bytes (128 B) copied0000020 N d ? nul nul nul nul nul nul nul nul nul nul nul nul nul
, 0.000253206 s, 506 kB/s
0000040 O R C L D I S K nul nul nul nul nul nul nul nul
0000060 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000100 nul nul sp vt etx nul soh etx D A T A _ 0 0 0
0000120 3 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000140 nul nul nul nul nul nul nul nul D A T A nul nul nul nul
0000160 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000200
[root@db2 ~]#
下面例子使对使用/etc/init.d/oracleasm createdisk命令所创建的ASMLIB磁盘进行一个简单的dump 注意YB_DATA4被写入ORCLDISK标签中:
[root@db2 ~]# oracleasm querydisk -v -p YB_DATA4
Disk "YB_DATA4" is a valid ASM disk
/dev/sdn: LABEL="YB_DATA4" TYPE="oracleasm"
/dev/sdae: LABEL="YB_DATA4" TYPE="oracleasm"
/dev/mapper/yb_data4: LABEL="YB_DATA4" TYPE="oracleasm"
[root@db2 ~]# dd if=/dev/mapper/yb_data4 bs=128 count=1 | od -a
1+0 records in
1+0 records out
128 bytes (128 B) copied, 0.000204442 s, 626 kB/s
0000000 soh stx soh soh nul nul nul nul etx nul nul nul K eot [ l
0000020 N d ? nul nul nul nul nul nul nul nul nul nul nul nul nul
0000040 O R C L D I S K Y B _ D A T A 4
0000060 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000100 nul nul sp vt etx nul soh etx D A T A _ 0 0 0
0000120 3 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000140 nul nul nul nul nul nul nul nul D A T A nul nul nul nul
0000160 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
0000200
在这个例子中,标记ORCLDISK与YB_DATA4被写入磁盘头。下面ASMLIB扫描磁盘时,它将查看标记 ORCLDISK与YB_DATA4,并使用YB_DATA创建一个ASMLIB磁盘到设备的映射。后续,ASM将通过ASMLIB驱 动来发现这个磁盘。如果磁盘最初没有通过ASMLIB管理,当ASM发现磁盘时,将通过ASM裸设备访问, 它将检测试没有ASMLIB标记存在。这就是为什么从ASMLIB访问迁移到裸设备来访问不存在问题的原因 。
使用ASMLIB与Multipath工具
多路径设备使用伪设备来生成虚拟子路径。在执行磁盘发现操作时,ASMLIB使用伪文 件/proc/partitions。这是一个Linux文件它记录了所有设备与之匹配的分区。
[root@db2 ~]# cat /proc/partitions
major minor #blocks name
11 0 1048575 sr0
11 1 1048575 sr1
8 0 1171062784 sda
8 1 204800 sda1
8 2 16777216 sda2
8 3 1154079744 sda3
8 64 629145600 sde
8 48 10485760 sdd
8 32 10485760 sdc
8 80 629145600 sdf
8 96 629145600 sdg
8 112 10485760 sdh
8 128 629145600 sdi
8 144 629145600 sdj
8 160 629145600 sdk
8 176 629145600 sdl
8 192 629145600 sdm
8 224 629145600 sdo
8 208 629145600 sdn
65 0 629145600 sdq
8 240 209715200 sdp
65 16 629145600 sdr
65 32 629145600 sds
65 48 10485760 sdt
65 64 10485760 sdu
65 80 629145600 sdv
65 96 629145600 sdw
65 112 629145600 sdx
65 128 10485760 sdy
65 144 629145600 sdz
65 160 629145600 sdaa
65 176 629145600 sdab
65 192 629145600 sdac
65 208 629145600 sdad
65 224 629145600 sdae
65 240 629145600 sdaf
66 0 209715200 sdag
66 16 629145600 sdah
66 32 629145600 sdai
66 48 629145600 sdaj
252 0 1154076672 dm-0
252 1 10485760 dm-1
252 2 10485760 dm-2
252 3 629145600 dm-3
252 4 629145600 dm-4
252 5 629145600 dm-5
252 6 10485760 dm-6
252 7 629145600 dm-7
252 8 629145600 dm-8
252 9 629145600 dm-9
252 10 629145600 dm-10
252 11 629145600 dm-11
252 12 629145600 dm-12
252 13 629145600 dm-13
252 14 209715200 dm-14
252 15 629145600 dm-15
252 16 629145600 dm-16
252 17 629145600 dm-17
为了让多路径正确工作,ASMLIB必须只能对伪设备操作。因此ASMLIB必须使用伪设备来进行修改。通 过修改/etc/sysconfig/oracleasm中的两个参数来进行配置:
.oracleasm_scanorder使用通用前缀指定ASMLIB扫描设备的顺序。
.oracleasm_scanexclude通过ASMLIB指定那个设备不被发现。
例如,使用IBM v7000与多路径配置ASMLIB进行如下设置:
ORACLEASM_SCANORDER="dm"
ORACLEASM_SCANEXCLUDE="sd"
在这个例子中,ASMLIB基于/dev/dm来扫描磁盘并且排除/dev/sd*的设备。下面 是/etc/sysconfig/oracleasm文件的一个配置例子:
[root@db2 ~]# cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver. It is generated
# By running /etc/init.d/oracleasm configure. Please use that method
# to modify this file
#
# ORACLEASM_ENABLED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true
# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=grid
# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=asmadmin
# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="dm"
# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE="sd"
# ORACLEASM_USE_LOGICAL_BLOCK_SIZE: 'true' means use the logical block size
# reported by the underlying disk instead of the physical. The default
# is 'false'
ORACLEASM_USE_LOGICAL_BLOCK_SIZE=false
小结:
ASMLIB是Oracle 10g与11g中ASM功能的支持library。ASMLIB允许Oracle数据库更有效的使用ASM与访 问磁盘组。ASMLIB的目的,它是ASM的一个插件,提供了一种识别与访问块设备的替接口。另外, ASMLIB API能够让存储与操作系统厂商来提供存储相关的扩展功能。这些功能可能提供一些好处,比 如提高性能与增加完整性。但ASMLIB对于ASM不是必须使用的。
3.3.1.4
Configuring Disks for Oracle
ASM with ASMLIB
The Oracle Automatic Storage Management (Oracle ASM) library driver (ASMLIB)
simplifies the configuration and management of the disk devices by eliminating
the need to rebind disk devices used with Oracle ASM each time the system is
restarted.
Without ASMLIB Linux 2.6 kernel and later, block device paths do not maintain
permissions and path persistence unless you create a permissions or rules file on each cluster member node; block device paths that
were /dev/sda can appear as /dev/sdb after a system
restart. Adding new disks requires you to modify the udev file to
provide permissions and path persistence for the new disk.
With ASMLIB, you define the range of disks you want to have made available as
Oracle ASM disks. ASMLIB maintains permissions and disk labels that are
persistent on the storage device, so that label is available even after an
operating system upgrade. You can update storage paths on all cluster member
nodes by running one oracleasm command on each node.
If you intend to use Oracle ASM on block devices for database storage for
Linux, then Oracle recommends that you install the ASMLIB driver and associated
utilities, and use them to configure the disks for Oracle ASM.
Caution:
On IBM: Linux on System z servers, due to a block
size compatibility issue, you cannot use ASMLIB with SCSI storage devices and
Fibre Channel Protocol (FCP) for Oracle Grid Infrastructure release 11.2.0.1 and
later.
Workaround:
use block device directly (for example,
using paths similar to /dev/mapper/mpatha_part1), or use DASD
disks.
See Also:
My Oracle Support notes How to Manually Configure
Disk Storage devices for use with Oracle ASM 11.2 on IBM: Linux on System z
under SLES (Doc ID
1350008.1
)
and How to Manually Configure Disk Storage devices for use with Oracle ASM 11.2
on IBM: Linux on System z under Red Hat 5 (Doc ID
1351746.1
),
available at the following URL:
To use the Oracle Automatic Storage Management library driver (ASMLIB) to
configure Oracle ASM devices, complete the following tasks.
Note:
To create a database during the installation using the
Oracle ASM library driver, you must choose an installation method that runs
ASMCA in interactive mode. You must also change the default disk discovery
string to ORCL:*.
3.3.1.4.1
Installing and Configuring
the Oracle ASM Library Driver Software
ASMLIB is already included with Unbreakable Enterprise Kernel packages, and
with SUSE 11. If you are a member of the Unbreakable Linux Network, then you can
install the ASMLIB rpms by subscribing to the Oracle Software for Enterprise
Linux channel, and using up2date to retrieve the most current
package for your system and kernel. For additional information, refer to the
following URL:
http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html
To install and configure the ASMLIB driver software manually, follow these
steps:
Enter the following command to determine the kernel version and architecture
of the system:
# uname -rm
Download the required ASMLIB packages from the Oracle Technology Network
(OTN) Web site:
http://www.oracle.com/technetwork/server-storage/linux/downloads/index-088143.html
Note:
You must install oracleasm-support package
version 2.0.1 or later to use ASMLIB on Red Hat Enterprise Linux 5 Advanced
Server. ASMLIB is already included with SUSE distributions.
Tip:
My Oracle Support note
1089399.1
for information about ASMLIB support with Red Hat distributions:
You must install the following packages, where version is the version of the ASMLIB
driver, arch is the system
architecture, and kernel is the
version of the kernel that you are using:
oracleasm-support-version.arch.rpm
oracleasm-kernel-version.arch.rpm
oracleasmlib-version.arch.rpm
Switch user to the root user:
$ su -
Enter a command similar to the following to install the packages:
# rpm -ivh oracleasm-support-version.arch.rpm \
oracleasm-kernel-version.arch.rpm \
oracleasmlib-version.arch.rpm
For example, if you are using the Red Hat Enterprise Linux 5 AS kernel on an
AMD64 system, then enter a command similar to the following:
# rpm -ivh oracleasm-support-2.1.3-1.el5.x86_64.rpm \
oracleasm-2.6.18-194.26.1.el5xen-2.0.5-1.el5.x86_64.rpm \
oracleasmlib-2.0.4-1.el5.x86_64.rpm
Enter the following command to run the oracleasm initialization script with the configure option:
# /usr/sbin/oracleasm configure -i
Note:
The oracleasm command in /usr/sbin is the command you should use. The /etc/init.d path is not deprecated, but the oracleasm binary in that path is now used typically for internal commands.
Enter the following information in response to the prompts that the script
displays:
Prompt
Suggested Response
Default user to own the driver
interface:
Standard groups and
users configuration
: Specify the Oracle software owner user (for example, oracle)
Job role separation groups and users configuration:
Specify the Grid Infrastructure software owner (for example, grid)
Default group to own the driver
interface:
Standard groups and
users configuration
: Specify the OSDBA group for the database (for
example, dba).
Job role separation groups and users configuration:
Specify the OSASM group for storage administration (for example, asmadmin).
Start Oracle ASM Library driver on
boot (y/n):
Enter y to start the
Oracle Automatic Storage Management library driver when the system
starts.
Scan for Oracle ASM disks on boot
(y/n)
Enter y to scan for
Oracle ASM disks when the system starts.
The script completes the following tasks:
Creates the /etc/sysconfig/oracleasm configuration file
Creates the /dev/oracleasm mount point
Mounts the ASMLIB driver file system
Note:
The ASMLIB driver file system is not a regular file
system. It is used only by the Oracle ASM library to communicate with the Oracle
ASM driver.
Enter the following command to load the oracleasm kernel
module:
# /usr/sbin/oracleasm init
Repeat this procedure on all nodes in the cluster where you want to install
Oracle RAC.
3.3.1.4.2
Configuring Disk Devices to
Use Oracle ASM Library Driver on x86 Systems
To configure the disk devices to use in an Oracle ASM disk group, follow
these steps:
If you intend to use IDE, SCSI, or RAID devices in the Oracle ASM disk group,
then follow these steps:
If necessary, install or configure the shared disk devices that you intend to
use for the disk group and restart the system.
To identify the device name for the disks to use, enter the following
command:
# /sbin/fdisk -l
Depending on the type of disk, the device name can vary:
Disk Type
Device Name Format
Description
IDE disk
/dev/hdxn
In this example, x is a letter that identifies the IDE disk
and n is the partition number.
For example, /dev/hda is the first disk on the first IDE
bus.
SCSI disk
/dev/sdxn
In this example, x is a letter that identifies the SCSI disk
and n is the partition number.
For example, /dev/sda is the first disk on the first SCSI
bus.
RAID disk
/dev/rd/cxdypz /dev/ida/cxdypz
Depending on the RAID controller,
RAID devices can have different device names. In the examples shown, x is a number that identifies the
controller, y is a number that
identifies the disk, and z is a
number that identifies the partition. For example, /dev/ida/c0d1 is
the second logical drive on the first
controller.
To
include devices in a disk group, you can specify either whole-drive device names
or partition device names.
Note:
Oracle recommends that you create a single whole-disk
partition on each disk.
Use either fdisk or parted to create a single
whole-disk partition on the disk devices.
Enter a command similar to the following to mark a disk as an Oracle ASM
disk:
# /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
In this example, DISK1 is the name you assign to the disk.
Note:
The disk names that you specify can contain uppercase
letters, numbers, and the underscore character. They must start with an
uppercase letter.
If you are using a multi-pathing disk driver with Oracle ASM, then make sure
that you specify the correct logical device name for the disk.
To make the disk available on the other nodes in the cluster, enter the
following command as root on each node:
# /usr/sbin/oracleasm scandisks
This command identifies shared disks attached to the node that are marked as
Oracle ASM disks.
3.3.1.4.3
Configuring Disk Devices to
Use ASM Library Driver on IBM: Linux on System z
If you formatted the DASD with the compatible disk layout, then enter a
command similar to the following to create a single whole-disk partition on the
device:
# /sbin/fdasd -a /dev/dasdxxxx
Enter a command similar to the following to mark a disk as an ASM disk:
# /etc/init.d/oracleasm createdisk DISK1 /dev/dasdxxxx
In this example, DISK1 is a name that you want to assign to the
disk.
Note:
The disk names that you specify can contain uppercase
letters, numbers, and the underscore character. They must start with an
uppercase letter.
If you are using a multi-pathing disk driver with ASM, then make sure that
you specify the correct logical device name for the disk.
To make the disk available on the other cluster nodes, enter the following
command as root on each node:
# /etc/init.d/oracleasm scandisks
This command identifies shared disks attached to the node that are marked as
ASM disks.
3.3.1.4.4
Administering the Oracle ASM
Library Driver and Disks
To administer the Oracle Automatic Storage Management library driver (ASMLIB)
and disks, use the oracleasm initialization script with different
options, as described in
Table 3-7
.
Table 3-7 ORACLEASM Script Options
Option
Description
configure
Use the configure option to reconfigure the Oracle Automatic
Storage Management library driver, if necessary:
# /usr/sbin/oracleasm configure -i
To see command options, enter oracleasm configure without the -i flag.
enable
disable
Use the disable and enable options to change the
actions of the Oracle Automatic Storage Management library driver when the
system starts. The enable option causes the Oracle Automatic
Storage Management library driver to load when the system starts:
# /usr/sbin/oracleasm enable
start
stop
restart
Use the start, stop, and restart options to load or unload the Oracle Automatic Storage Management library driver
without restarting the system:
# /usr/sbin/oracleasm restart
createdisk
Use the createdisk option to mark a disk device for use with the
Oracle Automatic Storage Management library driver and give it a name:
# /usr/sbin/oracleasm createdisk DISKNAME devicename
deletedisk
Use the deletedisk option to unmark a named disk device:
# /usr/sbin/oracleasm deletedisk DISKNAME
Caution:
Do not use this command to unmark disks that
are being used by an Oracle Automatic Storage Management disk group. You must
delete the disk from the Oracle Automatic Storage Management disk group before
you unmark it.
querydisk
Use the querydisk option to determine if a disk device or disk
name is being used by the Oracle Automatic Storage Management library
driver:
# /usr/sbin/oracleasm querydisk {DISKNAME | devicename}
listdisks
Use the listdisks option to list the disk names of marked Oracle
Automatic Storage Management library driver disks:
# /usr/sbin/oracleasm listdisks
scandisks
Use the scandisks option to enable cluster nodes to identify
which shared disks have been marked as Oracle Automatic Storage Management
library driver disks on another node:
# /usr/sbin/oracleasm scandisks
3.3.1.5
Configuring ASMLIB for
Multipath Disks
Additional configuration is required to use the Oracle Automatic Storage
Management library Driver (ASMLIB) with third party vendor multipath disks.
See Also:
My Oracle Support site for updates to supported
storage options:
https://support.oracle.com
3.3.1.5.1
About Using Oracle ASM with
Multipath Disks
Oracle ASM requires that each disk is uniquely identified. If the same disk
appears under multiple paths, then it causes errors. In a multipath disk
configuration, the same disk can appear three times:
The initial path to the disk
The second path to the disk
The multipath disk access point.
For example: If you have one local disk, /dev/sda, and one disk
attached with external storage, then your server shows two connections, or
paths, to that external storage. The Linux SCSI driver shows both paths. They
appear as /dev/sdb and /dev/sdc. The system may access
either /dev/sdb or /dev/sdc, but the access is to the
same disk.
If you enable multipathing, then you have a multipath disk (for example, /dev/multipatha), which can access both /dev/sdb and /dev sdc; any I/O to multipatha can use either the sdb or sdc path. If a system is using the /dev/sdb path, and that cable is unplugged, then the system shows
an error. But the multipath disk will switch from the /dev/sdb path
to the /dev/sdc path.
Most system software is unaware of multipath configurations. They can use any
paths (sdb, sdc or multipatha). ASMLIB
also is unaware of multipath configurations.
By default, ASMLIB recognizes the first disk path that Linux reports to it,
but because it imprints an identity on that disk, it recognizes that disk only
under one path. Depending on your storage driver, it may recognize the multipath
disk, or it may recognize one of the single disk paths.
Instead of relying on the default, you should configure Oracle ASM to
recognize the multipath disk.
3.3.1.5.2
Disk Scan Ordering
The
ASMLIB configuration file is located
in the path /etc/sysconfig/oracleasm. It contains all the startup
configuration you specified with the command /etc/init.d/oracleasm
configure. That command cannot configure scan ordering.
The configuration file contains many configuration variables. The ORACLEASM_SCANORDER variable specifies disks to be scanned first.
The ORACLEASM_SCANEXCLUDE variable specifies the disks that are to
be ignored.
Configure values for ORACLEASM_SCANORDER using space-delimited
prefix strings. A
prefix string
is the common string
associated with a type of disk. For example, if you use the prefix string sd, then this string matches all SCSI devices, including /dev/sda, /dev/sdb, /dev/sdc and so on.
Note that these are not globs. They do not use wild cards. They are simple
prefixes. Also note that the path is not a part of the prefix. For example, the /dev/ path is not part of the prefix for SCSI disks that are in the
path /dev/sd*.
For Oracle Linux and Red Hat Enterprise Linux version 5, when scanning, the
kernel sees the devices as /dev/mapper/XXX entries. By default, the 2.6 kernel
device file naming scheme udev creates the /dev/mapper/XXX names for human readability. Any configuration using ORACLEASM_SCANORDER should use the /dev/mapper/XXX entries.
3.3.1.5.3
Configuring Disk Scan
Ordering to Select Multipath Disks
To configure ASMLIB to select multipath disks first, complete the following
procedure:
Using a text editor, open the ASMLIB configuration file /etc/sysconfig/oracleasm.
Edit the ORACLEASM_SCANORDER variable to provide the prefix path of the
multipath disks. For example, if the multipath disks use the prefix multipath (/dev/mapper/multipatha, /dev/mapper/multipathb and so on), and the multipath disks mount
SCSI disks, then provide a prefix path similar to the following:
ORACLEASM_SCANORDER="multipath sd"
Save the file.
When you have completed this procedure, then when ASMLIB scans disks, it
first scans all disks with the prefix string multipath, and labels these disks
as Oracle ASM disks using the /dev/mapper/multipathX value. It then scans all disks with the
prefix string sd. However, because ASMLIB recognizes that these
disks have already been labeled with the /dev/mapper/multipath string values, it ignores these disks. After scanning for the prefix strings multipath and sd, Oracle ASM then scans for any other
disks that do not match the scan order.
In the example in step 2, the key word multipath is actually the alias for
multipath devices configured in /etc/multipath.conf under the multipaths section. For example:
multipaths {
multipath {
wwid 3600508b4000156d700012000000b0000
alias multipath
...
}
multipath {
...
alias mympath
...
}
...
}
The default device name is in the format /dev/mapper/mpath* (or a similar
path).
3.3.1.5.4
Configuring Disk Order Scan
to Exclude Single Path Disks
To configure ASMLIB to exclude particular single path disks, complete the
following procedure:
Using a text editor, open the ASMLIB configuration file /etc/sysconfig/oracleasm.
Edit the ORACLEASM_SCANEXCLUDE variable to provide the prefix
path of the single path disks. For example, if you want to exclude the single
path disks /dev sdb and /dev/sdc, then provide a
prefix path similar to the following:
ORACLEASM_SCANEXCLUDE="sdb sdc"
Save the file.
When you have completed this procedure, then when ASMLIB scans disks, it
scans all disks except for the disks with the sdb and sdc prefixes, so that it ignores /dev/sdb and /dev/sdc. It does not ignore other SCSI disks, nor multipath disks.
If you have a multipath disk (for example, /dev/multipatha), which
accesses both /dev/sdb and /dev sdc, but you have
configured ASMLIB to ignore sdb and sdc, then ASMLIB
ignores these disks and instead marks only the multipath disk as an Oracle ASM
disk.
在采用
asmlib
在采用
asmlib
驱动时,此时,通过
v$asm_
disk
可以通过如下的几种方法实现:
1
方法:
[root@rac1 ~]# dd if=/dev/sdb13 bs=1 count=45 |hexdump -c |more
45+0 records in
45+0 records out
45 bytes (45 B) copied, 9.4e-05 seconds, 479 kB/s
0000000 001 202 001 001 \0 \0 \0 \0 \0 \0 \0 200 253 243 245 371
0000010 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 O R C L D I S K V O L 1 2
000002d
为
VOL1
2
、通过
major号确定:
[root@rac1 ~]# ls -l /dev/oracleasm/disks/VOL12
brw-rw---- 1 oracle oinstall 8, 29 May 15 22:02 /dev/oracleasm/disks/VOL12
[root@rac1 ~]# ls -l /dev/sd* |grep "8, 29"
brw-r----- 1 root disk 8, 29 May 15 22:02 /dev/sdb13
[grid@node2 ~]$ cd /dev/oracleasm/disks/
[grid@node2 disks]$ ll
total 0
brw-rw---- 1 grid oinstall 8, 33 Mar 10 12:04 ARCHDISK
brw-rw---- 1 grid oinstall 8, 49 Mar 10 12:04 DATADISK
brw-rw---- 1 grid oinstall 8, 65 Mar 10 12:04 OVDISK
[grid@node2 disks]$ ls -l /dev/sd* |grep "8, 33"
brw-rw---- 1 grid oinstall 8, 33 Mar 10 12:04 /dev/sdc1
[grid@node2 disks]$ ls -l /dev/sd* |grep "8, 49"
brw-r----- 1 root disk 8, 49 Mar 10 12:04 /dev/sdd1
[grid@node2 disks]$ ls -l /dev/sd* |grep "8, 65"
brw-rw---- 1 grid oinstall 8, 65 Mar 10 12:04 /dev/sde1
[grid@node2 disks]$
由于一个测试的需要,笔者需要在redhat linxu 6.5上安装ASMLIB。
根据ORACLE的要求,在redhat上安装ASMLIB,需要安装如下三个包:
oracleasm-support-version.arch.rpm
oracleasm-kernel-version.arch.rpm
oracleasmlib-version.arch.rpm
可是,ORACLE为了推广她自己的ORACLE LINUX操作系统,上面三个rpm包只在redhat linux 5及以前版本提供,在redhat linux 6上,不再提供oracleasm-kernel-version.arch.rpm这个包了,但是在ORACLE linux上,这个包是集成在UEK中的,这直接导致在redhat linux 6上无法安装oracleasm-support-version.arch.rpm和oracleasmlib-version.arch.rpm这两个rpm包。ORACLE真是奸商啊。
但是redhat也不能坐以待毙呀,她就开发了kmod-oracleasm-XXX.el6.x86_64.rpm这个rpm包,在redhat linux 6上需要先安装它,才能安装得了oracle提供的oracleasmlib-version.arch.rpm包,kmod-oracleasm-XXX.el6.x86_64.rpm这个包在redhat的官网上的经授权的用户可以下载得到。
下面是笔者的redhat 6.5上为了使用asmlib而安装的三个包:
(1)kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm
--注意redhat 6.5它的内核版本号是2.6.32,,所以装的kmod-oracleasm的版本号是2.0.6.rh1-3,如果内核版本低于2.6.32,则装的kmod-oracleasm的版本号应该是2.0.6.rh1-2或更低版本
(2)oracleasm-support-2.1.8-1.el6.x86_64.rpm
(3)oracleasmlib-2.0.4-1.el6.x86_64.rpm