Linux下基于裸设备建立oracle 10g数据库
最近打算研究一下Linux裸设备,于是在linux下测试了一下基于裸设备创建Oracle 10g数据库看看。以下是简单步骤:
一、分区
分区的步骤不说了,把硬盘分为如下几个区:
[root@suk1 ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 44 353398+ 83 Linux
/dev/sdb2 45 69 200812+ 83 Linux
/dev/sdb3 70 88 152617+ 83 Linux
/dev/sdb4 89 522 3486105 5 Extended
/dev/sdb5 89 101 104391 83 Linux
/dev/sdb6 102 114 104391 83 Linux
/dev/sdb7 115 117 24066 83 Linux
/dev/sdb8 118 120 24066 83 Linux
/dev/sdb9 121 127 56196 83 Linux
/dev/sdb10 128 134 56196 83 Linux
2、绑定裸设备
绑定裸设备有两种方式
1)用命令绑定
[root@suk1 raw]# raw /dev/raw/raw1 /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
[root@suk1 raw]# raw /dev/raw/raw2 /dev/sdb2
/dev/raw/raw2: bound to major 8, minor 18
[root@suk1 raw]# raw /dev/raw/raw3 /dev/sdb3
/dev/raw/raw3: bound to major 8, minor 19
[root@suk1 raw]# raw /dev/raw/raw5 /dev/sdb5
/dev/raw/raw5: bound to major 8, minor 21
[root@suk1 raw]# raw /dev/raw/raw6 /dev/sdb6
/dev/raw/raw6: bound to major 8, minor 22
[root@suk1 raw]# raw /dev/raw/raw7 /dev/sdb7
/dev/raw/raw7: bound to major 8, minor 23
[root@suk1 raw]# raw /dev/raw/raw8 /dev/sdb8
/dev/raw/raw8: bound to major 8, minor 24
[root@suk1 raw]# raw /dev/raw/raw9 /dev/sdb9
/dev/raw/raw9: bound to major 8, minor 25
[root@suk1 raw]# raw /dev/raw/raw10 /dev/sdb10
/dev/raw/raw10: bound to major 8, minor 26
[root@suk1 raw]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 18
/dev/raw/raw3: bound to major 8, minor 19
/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
/dev/raw/raw10: bound to major 8, minor 26
注意:
/dev/sdb4是扩展分区,不要把裸设备绑定到那个分区上。
这种方式绑定的裸设备在OS重启后会失效,为了你重启后仍然生效,你可以修改/etc/rc.local文件,将如下内容加入到/etc/rc.local文件中:
raw /dev/raw/raw1 /dev/sdb1
raw /dev/raw/raw2 /dev/sdb2
raw /dev/raw/raw3 /dev/sdb3
raw /dev/raw/raw5 /dev/sdb5
raw /dev/raw/raw6 /dev/sdb6
raw /dev/raw/raw7 /dev/sdb7
raw /dev/raw/raw8 /dev/sdb8
raw /dev/raw/raw9 /dev/sdb9
raw /dev/raw/raw10 /dev/sdb10
这种方式实际上就是在开机的时候执行/etc/rc.local文件里的raw命令进行绑定的。
2)用服务的方式绑定
修改/etc/sysconfig/rawdevices文件如下,以开机时自动加载裸设备
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
/dev/raw/raw3 /dev/sdb3
/dev/raw/raw5 /dev/sdb5
/dev/raw/raw6 /dev/sdb6
/dev/raw/raw7 /dev/sdb7
/dev/raw/raw8 /dev/sdb8
/dev/raw/raw9 /dev/sdb9
/dev/raw/raw10 /dev/sdb10
然后启动服务:
[root@suk1 raw]# service rawdevices start
[root@suk1 raw]# service rawdevices start
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdb2
/dev/raw/raw2: bound to major 8, minor 18
/dev/raw/raw3 --> /dev/sdb3
/dev/raw/raw3: bound to major 8, minor 19
/dev/raw/raw5 --> /dev/sdb5
/dev/raw/raw5: bound to major 8, minor 21
/dev/raw/raw6 --> /dev/sdb6
/dev/raw/raw6: bound to major 8, minor 22
/dev/raw/raw7 --> /dev/sdb7
/dev/raw/raw7: bound to major 8, minor 23
/dev/raw/raw8 --> /dev/sdb8
/dev/raw/raw8: bound to major 8, minor 24
/dev/raw/raw9 --> /dev/sdb9
/dev/raw/raw9: bound to major 8, minor 25
/dev/raw/raw10 --> /dev/sdb10
这种方式绑定的裸设备在OS重启后仍然生效。
3、修改裸设备的属主
修改裸设备的属主也有两种方式:
1)命令修改
命令修改很简单:
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw1
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw2
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw3
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw4
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw5
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw6
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw7
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw8
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw9
[root@suk1 raw]# chown oracle:oinstall /dev/raw/raw10