SUSE Linux 10 配置裸设备(raw devices)

本文详细介绍了如何在SUSE Linux 10上通过裸设备配置来安装Oracle10gRAC,包括磁盘分区、裸设备创建与配置、权限设置等关键步骤。

裸设备,是没有经过格式化的分区或磁盘,也叫裸分区(原始分区),不被Unix通过文件系统来读取的特殊字符设备。它由应用程序负责对
它进行读写操作。不经过文件系统的缓冲,是不被操作系统直接管理的设备。由于跨过操作系统管理,使得I/O效率更高。在基于SUSE Linux 
10上安装Oracle 10g RAC的话,由于Oracle 10g 不支持将ocr与votingdisk 存放在ASM 磁盘中,因此,依然需要为其使用裸设备方式。SUSE 
Linux裸设备的配置与其他的Linux稍有差异,下面将具体描述。

[python]  view plain copy print ?
  1. 1、先对磁盘进行分区,sdd如下面的方法炮制  
  2. #下面的示例中使用sdc和sdd来用作裸设备,一块用于ocr,一块用于votingdisk  
  3. bo2dbp:~ # fdisk /dev/sdc  
  4. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel  
  5. Building a new DOS disklabel. Changes will remain in memory only,  
  6. until you decide to write them. After that, of course, the previous  
  7. content won't be recoverable.  
  8.   
  9. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)  
  10.   
  11. Command (m for help): n  
  12. Command action  
  13.    e   extended  
  14.    p   primary partition (1-4)  
  15. p  
  16. Partition number (1-4):   
  17. Value out of range.  
  18. Partition number (1-4):   
  19. Value out of range.  
  20. Partition number (1-4): 1  
  21. First cylinder (1-200, default 1):   
  22. Using default value 1  
  23. Last cylinder or +size or +sizeM or +sizeK (1-200, default 200):   
  24. Using default value 200  
  25.   
  26. Command (m for help): w  
  27. The partition table has been altered!  
  28.   
  29. Calling ioctl() to re-read partition table.  
  30. Syncing disks.  
  31.   
  32. 2、分区后的结果  
  33. bo2dbp:~ # fdisk -l /dev/sdc  
  34.   
  35. Disk /dev/sdc: 209 MB, 209715200 bytes  
  36. 64 heads, 32 sectors/track, 200 cylinders  
  37. Units = cylinders of 2048 * 512 = 1048576 bytes  
  38.   
  39.    Device Boot      Start         End      Blocks   Id  System  
  40. /dev/sdc1               1         200      204784   83  Linux  
  41. bo2dbp:~ # fdisk -l /dev/sdd  
  42.   
  43. Disk /dev/sdd: 209 MB, 209715200 bytes  
  44. 64 heads, 32 sectors/track, 200 cylinders  
  45. Units = cylinders of 2048 * 512 = 1048576 bytes  
  46.   
  47.    Device Boot      Start         End      Blocks   Id  System  
  48. /dev/sdd1               1         200      204784   83  Linux  
  49.   
  50. 3、配置裸设备  
  51. bo2dbp:~ # vi /etc/raw  
  52.   
  53. # /etc/raw  
  54. #  
  55. # sample configuration to bind raw devices  
  56. # to block devices  
  57. #  
  58. # The format of this file is:  
  59. # raw<N>:<blockdev>  
  60. #  
  61. # example:  
  62. # ---------  
  63. # raw1:hdb1  
  64. #  
  65. # this means: bind /dev/raw/raw1 to /dev/hdb1  
  66. #  
  67. # ...  
  68.   
  69. #Add new raw devices  
  70. raw1:sdc1  
  71. raw2:sdd1  
  72.   
  73. 4、启动裸设备  
  74. bo2dbp:~ # rcraw start  
  75. bind /dev/raw/raw1 to /dev/sdc1...                                    done  
  76. bind /dev/raw/raw2 to /dev/sdd1...                                    done  
  77.   
  78. 5、配置裸设备随系统启动  
  79. bo2dbp:~ # chkconfig raw  
  80. raw  on  
  81. #修改裸设备的权限与所有者,尽管该操作会修改,但重启之后将失效。永久修改见第7点  
  82. bo2dbp:~ # chown oracle:dba /dev/raw/raw[1-2]  
  83. bo2dbp:~ # chmod 660 /dev/raw/raw[1-2]  
  84.   
  85. 6、测试裸设备  
  86. bo2dbp:~ # dd if=/dev/zero of=/dev/raw/raw1 bs=1024k count=200  
  87. dd: writing `/dev/raw/raw1': No space left on device  
  88. 200+0 records in  
  89. 199+0 records out  
  90. 209698816 bytes (210 MB) copied, 2.59567 seconds, 80.8 MB/s  
  91.   
  92. 7、修改裸设备启动后权限及所有者  
  93. #使用root用户修改/etc/udev/rules.d/50-udev-default.rules,确保raw设备的权限GROUP="dba", MODE="660", OWNER="oracle"  
  94. #将其中包含KENREL=="raw"的记录修改为如下  
  95. KERNEL=="raw[0-9]*", SUBSYSTEM=="raw", NAME="raw/%k", GROUP="dba", MODE="640", OWNER="oracle"  
  96.   
  97. 8、确认配置成功  
  98. #重启之后的状态     #Author :Robinson Cheng  Blog:http://blog.youkuaiyun.com/robinson_0612  
  99. bo2dbp:~ # ls -hltr /dev/raw  
  100. total 0  
  101. crw-rw---- 1 root   disk 1620 Sep 19 10:22 rawctl  
  102. crw-rw---- 1 oracle dba  1621 Sep 19 10:22 raw1  
  103. crw-rw---- 1 oracle dba  1622 Sep 19 10:22 raw2  
  104.   
  105. bo2dbs:~ # /usr/sbin/raw -qa   
  106. /dev/raw/raw1:  bound to major 8, minor 33  
  107. /dev/raw/raw2:  bound to major 8, minor 49  

更多参考
Linux/Unix shell sql 之间传递变量 
Linux/Unix shell 脚本中调用SQL,RMAN脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值