您好,欢迎访问一九零五行业门户网

创建ASM磁盘组

asm磁盘组是作为一个逻辑单元管理的一个asm磁盘池。与其他任何lvm一样,asm管理大量物理卷并将其作为一个或多个逻辑卷呈交给oracle。物理卷可以是实际的磁盘或磁
asm磁盘组是作为一个逻辑单元管理的一个asm磁盘池。与其他任何lvm一样,asm管理大量物理卷并将其作为一个或多个逻辑卷呈交给oracle。物理卷可以是实际的磁盘或磁盘的分区,或者是隶属操作系统的卷管理器的卷。无论采用哪种方式,都不能使用任何文件系统格式化,必须是裸设备。
在linux上,asm能引用磁盘作为裸设备,或通过使用asmlib软件。
直接使用裸设备的方法:
1. 在rhel6以前的可以直接通过rawdevices的管理方法,系统安装后默认已存在/etc/init.d/rawdevices和/etc/sysconfig/rawdevices这两个文件。
# cat /etc/redhat-releasered hat enterprise linux server release 5.8 (tikanga)# rpm -qf /etc/init.d/rawdevices /etc/sysconfig/rawdevicesinitscripts-8.45.42-1.el5initscripts-8.45.42-1.el5# cat /etc/init.d/rawdevices#!/bin/bash## rawdevicesthis shell script assignes rawdevices to block devices## chkconfig: 345 56 44# description: this scripts assignes raw devices to block devices \#(such as hard drive partitions). this is for the use \#of applications such as oracle. you can set up the \#raw device to block device mapping by editing \#the file /etc/sysconfig/rawdevices.# config: /etc/sysconfig/rawdevices[ -f /bin/raw ] || exit 0[ -f /etc/sysconfig/rawdevices ] || exit 0# exit if the file just has the default comments.lc_all=c /bin/egrep -q -v ^ *# /etc/sysconfig/rawdevices 2>/dev/null || exit 0. /etc/init.d/functionsfunction assign_raw(){lc_all=c egrep -v '^ *#' /etc/sysconfig/rawdevices |while read raw block; doif [ -n $raw -a -n $block ]; thenrawdirname=${raw%/*}if [ $rawdirname = /dev -a -d /dev/raw ]; thenecho $ please correct your /etc/sysconfig/rawdevices:echo $rawdevices are now located in the directory /dev/raw/ echo $ if the command 'raw' still refers to /dev/raw as a file.echo $ you'll have to upgrade your util-linux packageexit 0fiif [ $rawdirname = /dev/raw -a -f /dev/raw ]; thenecho $ please correct your /etc/sysconfig/rawdevices:echo $rawdevices are now located in the directory /dev/raw/ echo $ if the command 'raw' still refers to /dev/raw as a file.echo $ you'll have to upgrade your util-linux packageexit 0fiecho $raw --> $block;raw $raw $blockfidone}# see how we were called.case $1 in start)# assign devicesecho $assigning devices: assign_raw#添加以下两行(默认不存在),即默认情况下生成的裸设备为root所有,#所以必须修改属主,否则oracle用户无法使用裸设备sleep 5chown -r oracle:oinstall /dev/raw/echo $done;; stop)# no action to be taken here;; status)id=`id -u`if [ $id -eq 0 ]; thenraw -qaelseecho $you need to be root to use this command ! fi;; restart|reload)$0 start;; *)echo $usage: $0 {start|stop|status|restart}exit 1esacexit 0
# vi /etc/sysconfig/rawdevices//映射将要绑定的裸设备/dev/raw/raw10 /dev/sda10/dev/raw/raw11 /dev/sda11/dev/raw/raw12 /dev/sda12/dev/raw/raw13 /dev/sda13/dev/raw/raw14 /dev/sda14# chkconfig rawdevices on# service rawdevices startassigning devices:/dev/raw/raw10 --> /dev/sda10/dev/raw/raw10: bound to major 8, minor 10/dev/raw/raw11 --> /dev/sda11/dev/raw/raw11: bound to major 8, minor 11/dev/raw/raw12 --> /dev/sda12/dev/raw/raw12: bound to major 8, minor 12/dev/raw/raw13 --> /dev/sda13/dev/raw/raw13: bound to major 8, minor 13/dev/raw/raw14 --> /dev/sda14/dev/raw/raw14: bound to major 8, minor 14done# ls -l /dev/raw/total 0crw-rw----. 1 oracle oinstall 162, 10 may 27 08:37 raw10crw-rw----. 1 oracle oinstall 162, 11 may 27 08:37 raw11crw-rw----. 1 oracle oinstall 162, 12 may 27 08:37 raw12crw-rw----. 1 oracle oinstall 162, 13 may 27 08:37 raw13crw-rw----. 1 oracle oinstall 162, 14 may 27 08:37 raw14crw-rw----. 1 oracle oinstall 162, 0 may 27 08:19 rawctl# raw -qa/dev/raw/raw10: bound to major 8, minor 10/dev/raw/raw11: bound to major 8, minor 11/dev/raw/raw12: bound to major 8, minor 12/dev/raw/raw13: bound to major 8, minor 13/dev/raw/raw14: bound to major 8, minor 14
2. 在rhel6中,系统里面虽然已经不存在/etc/sysconfig/rawdevices和/etc/init.d/rawdevices文件了,但是依然支持rawdevices的方式,网站空间,网站空间,可以通过如下方法来管理raw文件。
手动创建/etc/sysconfig/rawdevices和/etc/init.d/rawdevices文件,然后依然以rawdevices的方式
通过udev来管理raw,同样也可以通过udev固定磁盘对应的设备名
以下介绍udev的方式:
# fdisk -l /dev/sdbdisk /dev/sdb: 2147 mb, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersunits = cylinders of 16065 * 512 = 8225280 bytesdevice bootstartendblocks id system/dev/sdb112612096451 5 extended/dev/sdb5125200749+ 83 linux/dev/sdb62650200781 83 linux/dev/sdb75175200781 83 linux/dev/sdb876100200781 83 linux/dev/sdb9101125200781 83 linux# vi /etc/udev/rules.d/60-raw.rulesaction==add,kernel==sdb5,run+=/bin/raw /dev/raw/raw5 %n,owner=oracle, group=oinstall, mode=660action==add,kernel==sdb6,run+=/bin/raw /dev/raw/raw6 %n,owner=oracle, group=oinstall, mode=660action==add,kernel==sdb7,run+=/bin/raw /dev/raw/raw7 %n,owner=oracle, group=oinstall, mode=660action==add,kernel==sdb8,run+=/bin/raw /dev/raw/raw8 %n,owner=oracle, group=oinstall, mode=660action==add,kernel==sdb9,run+=/bin/raw /dev/raw/raw9 %n,owner=oracle, group=oinstall, mode=660# raw -qa# start_udevstarting udev: [ ok ]# raw -qa/dev/raw/raw5: bound to major 8, minor 21/dev/raw/raw6: bound to major 8, minor 22/dev/raw/raw7: bound to major 8, minor 23/dev/raw/raw8: bound to major 8, minor 24/dev/raw/raw9: bound to major 8, minor 25# ls -l /dev/rawtotal 0crw-rw---- 1 oracle oinstall 162, 5 jun 9 17:15 raw5crw-rw---- 1 oracle oinstall 162, 6 jun 9 17:15 raw6crw-rw---- 1 oracle oinstall 162, 7 jun 9 17:15 raw7crw-rw---- 1 oracle oinstall 162, 8 jun 9 17:15 raw8crw-rw---- 1 oracle oinstall 162, 9 jun 9 17:15 raw9
asmlib:(非linux系统只能使用裸设备的方法)
asmlib是一组可选的位于asm和硬件之间的一个内核驱动程序工具,也是作为一个应用程序库通过oracle数据库软件访问asm磁盘。
它是oracle 10g和11g单实例数据库以及rac的asm特性支持库。asm和数据库实例可以使用asmlib作为可替代的磁盘访问接口。
asmlib有以下三个组件:
内核驱动:oracleasm            linux中支持oracle asmlib的内核驱动程序(需根据内核版本下载)
支持工具:oracleasm-support    提供用于配置和启动asm驱动程序的实用工具
应用程序库:oracleasmlib       提供了实际的asm库
其它类似信息

推荐信息