zjhqlmzldx 2010-11-17
在以前的redhat版本中,系统通过/etc/sysconfig/rawdevices配置raw的控制文件,通过/etc/init.d/rawdevices来管理raw设备的启动和关闭。
redhat5正规的方法是通过udev来管理raw。裸设备绑定的重启命令为start_udev
今天在数据库检查过程中碰到一客户,没有在系统启动过程实现裸设备自动绑定。简单做下记录,以便不时之需。
[root@wms01dbcheck]#more/etc/redhat-release
CentOSrelease5.2(Final)
wms:
[root@wms01~]#cd/dev/raw
[root@wms01raw]#ls-rtl
total0
crw-rw----1rootoinstall162,19Aug814:29raw19
crwxr-xr-x1oracleoinstall162,12Aug814:29raw12
crwxr-xr-x1oracleoinstall162,13Aug814:29raw13
crwxr-xr-x1oracleoinstall162,5Nov1713:54raw5
crwxr-xr-x1oracleoinstall162,7Nov1713:54raw7
crwxr-xr-x1oracleoinstall162,4Nov1713:54raw4
crw-r--r--1oracleoinstall162,20Nov1713:54raw20
crwxr-xr-x1oracleoinstall162,2Nov1713:54raw2
crwxr-xr-x1oracleoinstall162,3Nov1713:54raw3
crwxr-xr-x1oracleoinstall162,9Nov1713:54raw9
crwxr-xr-x1oracleoinstall162,8Nov1713:54raw8
crwxr-xr-x1oracleoinstall162,6Nov1713:54raw6
crwxr-xr-x1oracleoinstall162,11Nov1713:54raw11
crwxr-xr-x1oracleoinstall162,10Nov1713:54raw10
[root@wms01raw]#raw-qa
/dev/raw/raw2:boundtomajor253,minor27
/dev/raw/raw3:boundtomajor253,minor19
/dev/raw/raw4:boundtomajor253,minor28
/dev/raw/raw5:boundtomajor253,minor29
/dev/raw/raw6:boundtomajor253,minor8
/dev/raw/raw7:boundtomajor253,minor9
/dev/raw/raw8:boundtomajor253,minor10
/dev/raw/raw9:boundtomajor253,minor11
/dev/raw/raw10:boundtomajor253,minor12
/dev/raw/raw11:boundtomajor253,minor13
/dev/raw/raw12:boundtomajor253,minor14
/dev/raw/raw13:boundtomajor253,minor15
/dev/raw/raw19:boundtomajor253,minor33
/dev/raw/raw20:boundtomajor253,minor31
[root@wms01dev]#ls-rtl|grep253
brw-------1rootroot253,0Aug814:27root
brw-rw----1rootroot253,9Aug814:28dm-9
brw-rw----1rootroot253,10Aug814:28dm-10
brw-rw----1rootroot253,11Aug814:28dm-11
brw-rw----1rootroot253,12Aug814:28dm-12
brw-rw----1rootroot253,13Aug814:28dm-13
brw-rw----1rootroot253,14Aug814:28dm-14
brw-rw----1rootroot253,15Aug814:28dm-15
brw-rw----1rootroot253,16Aug814:28dm-16
brw-rw----1rootroot253,17Aug814:28dm-17
brw-rw----1rootroot253,18Aug814:28dm-18
brw-rw----1rootroot253,19Aug814:28dm-19
brw-rw----1rootroot253,22Aug814:28dm-22
brw-rw----1rootroot253,20Aug814:28dm-20
brw-rw----1rootroot253,24Aug814:28dm-24
brw-rw----1rootroot253,21Aug814:28dm-21
brw-rw----1rootroot253,23Aug814:28dm-23
brw-rw----1rootroot253,26Aug814:28dm-26
brw-rw----1rootroot253,27Aug814:28dm-27
brw-rw----1rootroot253,28Aug814:28dm-28
brw-rw----1rootroot253,29Aug814:28dm-29
brw-rw----1rootroot253,31Aug814:28dm-31
brw-rw----1rootroot253,30Aug814:28dm-30
brw-rw----1rootroot253,32Aug814:28dm-32
brw-rw----1rootroot253,33Aug814:28dm-33
brw-rw----1rootroot253,8Aug814:28dm-8
brw-rw----1rootroot253,25Aug814:28dm-25
SQL>colnamefora20
SQL>colpathfora20
SQL>selectname,pathfromv$asm_disk;
NAMEPATH
----------------------------------------
/dev/raw/raw20
/dev/raw/raw19
LOGASM1_0001/dev/raw/raw13
LOGASM1_0000/dev/raw/raw12
DGASM1_0009/dev/raw/raw11
DGASM1_0008/dev/raw/raw10
DGASM1_0007/dev/raw/raw9
DGASM1_0006/dev/raw/raw8
DGASM1_0005/dev/raw/raw7
DGASM1_0004/dev/raw/raw6
DGASM1_0003/dev/raw/raw5
NAMEPATH
----------------------------------------
DGASM1_0002/dev/raw/raw4
DGASM1_0001/dev/raw/raw3
DGASM1_0000/dev/raw/raw2
14rowsselected.
[oracle@wms01~]$crsctlquerycssvotedisk
0.0/dev/raw/raw20
located1votedisk(s).
[oracle@wms01~]$ocrcheck
StatusofOracleClusterRegistryisasfollows:
Version:2
Totalspace(kbytes):1027888
Usedspace(kbytes):4600
Availablespace(kbytes):1023288
ID:2049410580
Device/FileName:/dev/raw/raw19
Device/Fileintegritychecksucceeded
Device/Filenotconfigured
Clusterregistryintegritychecksucceeded
[oracle@wms01dbs]$moreinit+ASM1.ora
##############################################################################
#Copyright(c)1991,2001,2002byOracleCorporation
##############################################################################
###########################################
#ClusterDatabase
###########################################
cluster_database=true
###########################################
#DiagnosticsandStatistics
###########################################
background_dump_dest=/oracle/admin/+ASM/bdump
core_dump_dest=/oracle/admin/+ASM/cdump
user_dump_dest=/oracle/admin/+ASM/udump
###########################################
#Miscellaneous
###########################################
instance_type=asm
###########################################
#Pools
###########################################
large_pool_size=12M
###########################################
#SecurityandAuditing
###########################################
remote_login_passwordfile=exclusive
asm_power_limit=5
asm_diskgroups='DGASM1','LOGASM1'
asm_diskstring='/dev/raw/*'
+ASM2.instance_number=2
+ASM1.instance_number=1
最终配置
/home/oracle/dbcheck/60-raw.rules
#Thisfileandinterfacearedeprecated.
#Applicationsneedingrawdeviceaccessshouldopenregular
#blockdeviceswithO_DIRECT.
#
#Enterrawdevicebindingshere.
#
#Anexamplewouldbe:
#ACTION=="add",KERNEL=="sda",RUN+="/bin/raw/dev/raw/raw1%N"
#tobind/dev/raw/raw1to/dev/sda,or
#ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="1",RUN+="/bin/raw/dev/raw/raw2%M%m"
#tobind/dev/raw/raw2tothedevicewithmajor8,minor1.
[root@wms01dbcheck]#vi60-raw.rules
#Thisfileandinterfacearedeprecated.
#Applicationsneedingrawdeviceaccessshouldopenregular
#blockdeviceswithO_DIRECT.
#
#Enterrawdevicebindingshere.
#
#Anexamplewouldbe:
#ACTION=="add",KERNEL=="sda",RUN+="/bin/raw/dev/raw/raw1%N"
#tobind/dev/raw/raw1to/dev/sda,or
#ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="1",RUN+="/bin/raw/dev/raw/raw2%M%m"
#tobind/dev/raw/raw2tothedevicewithmajor8,minor1.
ACTION=="add",KERNEL=="dm-27",RUN+="/bin/raw/dev/raw/raw2%N"
ACTION=="add",KERNEL=="dm-19",RUN+="/bin/raw/dev/raw/raw3%N"
ACTION=="add",KERNEL=="dm-28",RUN+="/bin/raw/dev/raw/raw4%N"
ACTION=="add",KERNEL=="dm-29",RUN+="/bin/raw/dev/raw/raw5%N"
ACTION=="add",KERNEL=="dm-8",RUN+="/bin/raw/dev/raw/raw6%N"
ACTION=="add",KERNEL=="dm-9",RUN+="/bin/raw/dev/raw/raw7%N"
ACTION=="add",KERNEL=="dm-10",RUN+="/bin/raw/dev/raw/raw8%N"
ACTION=="add",KERNEL=="dm-11",RUN+="/bin/raw/dev/raw/raw9%N"
ACTION=="add",KERNEL=="dm-12",RUN+="/bin/raw/dev/raw/raw10%N"
ACTION=="add",KERNEL=="dm-13",RUN+="/bin/raw/dev/raw/raw11%N"
ACTION=="add",KERNEL=="dm-14",RUN+="/bin/raw/dev/raw/raw12%N"
ACTION=="add",KERNEL=="dm-15",RUN+="/bin/raw/dev/raw/raw13%N"
ACTION=="add",KERNEL=="dm-33",RUN+="/bin/raw/dev/raw/raw19%N"
ACTION=="add",KERNEL=="dm-31",RUN+="/bin/raw/dev/raw/raw20%N"
KERNEL=="raw[2-13]",OWNER="oracle",GROUP="oinstall",MODE="755"
KERNEL=="raw[19]",OWNER="root",GROUP="oinstall",MODE="660"
KERNEL=="raw[20]",OWNER="oracle",GROUP="oinstall",MODE="644"
erp:
[root@erp01~]#cd/dev/raw
[root@erp01raw]#ls-rtl
total0
crwxr-xr-x1oracleoinstall162,23Apr72010raw23
crwxr-xr-x1oracleoinstall162,18Nov1714:27raw18
crwxr-xr-x1oracleoinstall162,17Nov1714:27raw17
crwxr-xr-x1oracleoinstall162,12Nov1714:27raw12
crw-rw----1rootoinstall162,2Nov1714:27raw2
crwxr-xr-x1oracleoinstall162,8Nov1714:27raw8
crwxr-xr-x1oracleoinstall162,14Nov1714:27raw14
crwxr-xr-x1oracleoinstall162,19Nov1714:27raw19
crwxr-xr-x1oracleoinstall162,21Nov1714:27raw21
crwxr-xr-x1oracleoinstall162,16Nov1714:27raw16
crwxr-xr-x1oracleoinstall162,13Nov1714:27raw13
crwxr-xr-x1oracleoinstall162,11Nov1714:27raw11
crwxr-xr-x1oracleoinstall162,15Nov1714:27raw15
crwxr-xr-x1oracleoinstall162,9Nov1714:27raw9
crwxr-xr-x1oracleoinstall162,7Nov1714:27raw7
crwxr-xr-x1oracleoinstall162,20Nov1714:27raw20
crw-r--r--1oracleoinstall162,3Nov1714:27raw3
crwxr-xr-x1oracleoinstall162,22Nov1714:27raw22
crwxr-xr-x1oracleoinstall162,10Nov1714:27raw10
[root@erp01raw]#raw-qa
/dev/raw/raw2:boundtomajor253,minor25
/dev/raw/raw3:boundtomajor253,minor27
/dev/raw/raw7:boundtomajor253,minor29
/dev/raw/raw8:boundtomajor253,minor30
/dev/raw/raw9:boundtomajor253,minor31
/dev/raw/raw10:boundtomajor253,minor32
/dev/raw/raw11:boundtomajor253,minor33
/dev/raw/raw12:boundtomajor253,minor34
/dev/raw/raw13:boundtomajor253,minor35
/dev/raw/raw14:boundtomajor253,minor36
/dev/raw/raw15:boundtomajor253,minor37
/dev/raw/raw16:boundtomajor253,minor8
/dev/raw/raw17:boundtomajor253,minor9
/dev/raw/raw18:boundtomajor253,minor10
/dev/raw/raw19:boundtomajor253,minor11
/dev/raw/raw20:boundtomajor253,minor12
/dev/raw/raw21:boundtomajor253,minor13
/dev/raw/raw22:boundtomajor253,minor7
/dev/raw/raw23:boundtomajor253,minor14
root@erp01dev]#ls-rtl|grep253
brw-------1rootroot253,0Sep132009root
brw-rw----1rootroot253,8Sep132009dm-8
brw-rw----1rootroot253,9Sep132009dm-9
brw-rw----1rootroot253,10Sep132009dm-10
brw-rw----1rootroot253,11Sep132009dm-11
brw-rw----1rootroot253,12Sep132009dm-12
brw-rw----1rootroot253,13Sep132009dm-13
brw-rw----1rootroot253,14Sep132009dm-14
brw-rw----1rootroot253,15Sep132009dm-15
brw-rw----1rootroot253,16Sep132009dm-16
brw-rw----1rootroot253,18Sep132009dm-18
brw-rw----1rootroot253,17Sep132009dm-17
brw-rw----1rootroot253,19Sep132009dm-19
brw-rw----1rootroot253,20Sep132009dm-20
brw-rw----1rootroot253,22Sep132009dm-22
brw-rw----1rootroot253,21Sep132009dm-21
brw-rw----1rootroot253,24Sep132009dm-24
brw-rw----1rootroot253,23Sep132009dm-23
brw-rw----1rootroot253,25Sep132009dm-25
brw-rw----1rootroot253,28Sep132009dm-28
brw-rw----1rootroot253,27Sep132009dm-27
brw-rw----1rootroot253,26Sep132009dm-26
brw-rw----1rootroot253,29Sep132009dm-29
brw-rw----1rootroot253,30Sep132009dm-30
brw-rw----1rootroot253,32Sep132009dm-32
brw-rw----1rootroot253,33Sep132009dm-33
brw-rw----1rootroot253,34Sep132009dm-34
brw-rw----1rootroot253,35Sep132009dm-35
brw-rw----1rootroot253,36Sep132009dm-36
brw-rw----1rootroot253,37Sep132009dm-37
brw-rw----1rootroot253,7Sep132009dm-7
brw-rw----1rootroot253,31Sep132009dm-31
SQL>colnamefora20
SQL>colpathfora20
SQL>selectname,pathfromv$asm_disk;
NAMEPATH
----------------------------------------
/dev/raw/raw3
/dev/raw/raw2
LOGASM1_0001/dev/raw/raw23
LOGASM1_0000/dev/raw/raw22
DGASM1_0011/dev/raw/raw21
DGASM1_0010/dev/raw/raw20
DGASM1_0009/dev/raw/raw19
DGASM1_0008/dev/raw/raw18
DGASM1_0007/dev/raw/raw17
DGASM1_0006/dev/raw/raw16
DGASM1_0005/dev/raw/raw15
NAMEPATH
----------------------------------------
DGASM1_0004/dev/raw/raw14
DGASM1_0003/dev/raw/raw13
DGASM1_0002/dev/raw/raw12
DGASM1_0001/dev/raw/raw11
DGASM1_0000/dev/raw/raw10
DGASM1_0014/dev/raw/raw9
DGASM1_0013/dev/raw/raw8
DGASM1_0012/dev/raw/raw7
19rowsselected.
[oracle@erp01dbs]$moreinit+ASM1.ora
##############################################################################
#Copyright(c)1991,2001,2002byOracleCorporation
##############################################################################
###########################################
#ClusterDatabase
###########################################
cluster_database=true
###########################################
#DiagnosticsandStatistics
###########################################
background_dump_dest=/oracle/admin/+ASM/bdump
core_dump_dest=/oracle/admin/+ASM/cdump
user_dump_dest=/oracle/admin/+ASM/udump
###########################################
#Miscellaneous
###########################################
instance_type=asm
###########################################
#Pools
###########################################
large_pool_size=12M
###########################################
#SecurityandAuditing
###########################################
remote_login_passwordfile=exclusive
asm_power_limit=5
asm_diskgroups='DGASM1','LOGASM1'
asm_diskstring='/dev/raw/raw*'
+ASM2.instance_number=2
+ASM1.instance_number=1
[oracle@erp01dbs]$crsctlquerycssvotedisk
0.0/dev/raw/raw3
located1votedisk(s).
[oracle@erp01dbs]$ocrcheck
StatusofOracleClusterRegistryisasfollows:
Version:2
Totalspace(kbytes):1027888
Usedspace(kbytes):4588
Availablespace(kbytes):1023300
ID:499063683
Device/FileName:/dev/raw/raw2
Device/Fileintegritychecksucceeded
Device/Filenotconfigured
Clusterregistryintegritychecksucceeded
最终配置
/home/oracle/dbcheck/60-raw.rules
ACTION=="add",KERNEL=="dm-25",RUN+="/bin/raw/dev/raw/raw2%N"
ACTION=="add",KERNEL=="dm-27",RUN+="/bin/raw/dev/raw/raw3%N"
ACTION=="add",KERNEL=="dm-29",RUN+="/bin/raw/dev/raw/raw7%N"
ACTION=="add",KERNEL=="dm-30",RUN+="/bin/raw/dev/raw/raw8%N"
ACTION=="add",KERNEL=="dm-31",RUN+="/bin/raw/dev/raw/raw9%N"
ACTION=="add",KERNEL=="dm-32",RUN+="/bin/raw/dev/raw/raw10%N"
ACTION=="add",KERNEL=="dm-33",RUN+="/bin/raw/dev/raw/raw11%N"
ACTION=="add",KERNEL=="dm-34",RUN+="/bin/raw/dev/raw/raw12%N"
ACTION=="add",KERNEL=="dm-35",RUN+="/bin/raw/dev/raw/raw13%N"
ACTION=="add",KERNEL=="dm-36",RUN+="/bin/raw/dev/raw/raw14%N"
ACTION=="add",KERNEL=="dm-37",RUN+="/bin/raw/dev/raw/raw15%N"
ACTION=="add",KERNEL=="dm-8",RUN+="/bin/raw/dev/raw/raw16%N"
ACTION=="add",KERNEL=="dm-9",RUN+="/bin/raw/dev/raw/raw17%N"
ACTION=="add",KERNEL=="dm-10",RUN+="/bin/raw/dev/raw/raw18%N"
ACTION=="add",KERNEL=="dm-11",RUN+="/bin/raw/dev/raw/raw19%N"
ACTION=="add",KERNEL=="dm-12",RUN+="/bin/raw/dev/raw/raw20%N"
ACTION=="add",KERNEL=="dm-13",RUN+="/bin/raw/dev/raw/raw21%N"
ACTION=="add",KERNEL=="dm-7",RUN+="/bin/raw/dev/raw/raw22%N"
ACTION=="add",KERNEL=="dm-14",RUN+="/bin/raw/dev/raw/raw23%N"
KERNEL=="raw[7-23]",OWNER="oracle",GROUP="oinstall",MODE="755"
KERNEL=="raw[2]",OWNER="root",GROUP="oinstall",MODE="660"
KERNEL=="raw[3]",OWNER="oracle",GROUP="oinstall",MODE="644"