欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

RHEL5上裸设备上面安装Oracle 10g

程序员文章站 2024-02-05 14:42:22
...

实验环境:Red Hat Enterprise Linux Server release 5ORALCE 10g 10.2.0.1一、磁盘规划分区我的实验机器上存在三块硬盘,sda,s

实验环境:
Red Hat Enterprise Linux Server release 5
ORALCE 10g 10.2.0.1

一、磁盘规划分区
我的实验机器上存在三块硬盘,sda,sdb,sdc。其中sda只用来安装了操作系统,以及应用软件;sdb划分分区,这块硬盘用来存放数据库系统文件system,sysaux等等;sdc这块硬盘划分相应的分区,这块硬盘主要用来存放业务数据。

使用fdisk命令划分分区,具体过程略,创建完所有分区以后,使用如下命令来查看:
# fdisk -l
Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1697 13631121 83 Linux
/dev/sda2 1698 1958 2096482+ 82 Linux swap / Solaris
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 5 Extended
/dev/sdb5 1 13 104359+ 83 Linux
/dev/sdb6 14 26 104391 83 Linux
/dev/sdb7 27 39 104391 83 Linux
/dev/sdb8 40 52 104391 83 Linux
/dev/sdb9 53 59 56196 83 Linux
/dev/sdb10 60 182 987966 83 Linux
/dev/sdb11 183 305 987966 83 Linux
/dev/sdb12 306 428 987966 83 Linux
/dev/sdb13 429 652 1799248+ 83 Linux
Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 652 5237158+ 5 Extended
/dev/sdc5 1 123 987934+ 83 Linux
/dev/sdc6 124 246 987966 83 Linux
/dev/sdc7 247 369 987966 83 Linux
/dev/sdc8 370 492 987966 83 Linux
/dev/sdc9 493 620 1028128+ 83 Linux
/dev/sdc10 621 652 257008+ 83 Linux


二、为裸设备建立映射关系
在root提示符下键入:
# raw -a
查询当前已经建立的raw设备名,目前为空,我们可以从第一个设备名用起,
在root提示符下键入:
raw /dev/raw/raw1 /dev/sdb5
raw /dev/raw/raw2 /dev/sdb6
raw /dev/raw/raw3 /dev/sdb7
raw /dev/raw/raw4 /dev/sdb8
raw /dev/raw/raw5 /dev/sdb9
raw /dev/raw/raw6 /dev/sdb10
raw /dev/raw/raw7 /dev/sdb11
raw /dev/raw/raw8 /dev/sdb12
raw /dev/raw/raw9 /dev/sdc5
raw /dev/raw/raw10 /dev/sdc6
raw /dev/raw/raw11 /dev/sdc7
raw /dev/raw/raw12 /dev/sdc8
raw /dev/raw/raw13 /dev/sdc9
raw /dev/raw/raw14 /dev/sdc10
至此,我们创建了14个raw设备名,用于交给Oracle直接管理,,查看一下已经创建的raw设备名的情况:

# raw -a
/dev/raw/raw1: bound to major 8, minor 21
/dev/raw/raw2: bound to major 8, minor 22
/dev/raw/raw3: bound to major 8, minor 23
/dev/raw/raw4: bound to major 8, minor 24
/dev/raw/raw5: bound to major 8, minor 25
/dev/raw/raw6: bound to major 8, minor 26
/dev/raw/raw7: bound to major 8, minor 27
/dev/raw/raw8: bound to major 8, minor 28
/dev/raw/raw9: bound to major 8, minor 37
/dev/raw/raw10: bound to major 8, minor 38
/dev/raw/raw11: bound to major 8, minor 39
/dev/raw/raw12: bound to major 8, minor 40
/dev/raw/raw13: bound to major 8, minor 41
/dev/raw/raw14: bound to major 8, minor 42

如果想删除一个raw设备名(例如/dev/raw/raw1),在root提示符下键入:
# raw /dev/raw/raw1 0 0
这样创建的裸设备在重启后会失效,需要修改系统文件。

修改系统的初始化文件,添加如下行到 /etc/rc.local 文件:
raw /dev/raw/raw1 /dev/sdb5
raw /dev/raw/raw2 /dev/sdb6
raw /dev/raw/raw3 /dev/sdb7
raw /dev/raw/raw4 /dev/sdb8
raw /dev/raw/raw5 /dev/sdb9
raw /dev/raw/raw6 /dev/sdb10
raw /dev/raw/raw7 /dev/sdb11
raw /dev/raw/raw8 /dev/sdb12
raw /dev/raw/raw9 /dev/sdc5
raw /dev/raw/raw10 /dev/sdc6
raw /dev/raw/raw11 /dev/sdc7
raw /dev/raw/raw12 /dev/sdc8
raw /dev/raw/raw13 /dev/sdc9
raw /dev/raw/raw14 /dev/sdc10
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
chmod 660 /dev/raw/raw6
chmod 660 /dev/raw/raw7
chmod 660 /dev/raw/raw8
chmod 660 /dev/raw/raw9
chmod 660 /dev/raw/raw10
chmod 660 /dev/raw/raw11
chmod 660 /dev/raw/raw12
chmod 660 /dev/raw/raw13
chmod 660 /dev/raw/raw14
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
chown oracle.dba /dev/raw/raw6
chown oracle.dba /dev/raw/raw7
chown oracle.dba /dev/raw/raw8
chown oracle.dba /dev/raw/raw9
chown oracle.dba /dev/raw/raw10
chown oracle.dba /dev/raw/raw11
chown oracle.dba /dev/raw/raw12
chown oracle.dba /dev/raw/raw13
chown oracle.dba /dev/raw/raw14
也可以修改etc/udev/rules.d/60-raw.rules文件,添加如下记录
ACTION=="add",KERNEL=="sdb5",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="sdb6",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="sdb7",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="sdb8",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add",KERNEL=="sdb9",RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add",KERNEL=="sdb10",RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add",KERNEL=="sdb11",RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add",KERNEL=="sdb12",RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add",KERNEL=="sdc5",RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add",KERNEL=="sdc6",RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add",KERNEL=="sdc7",RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add",KERNEL=="sdc8",RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add",KERNEL=="sdc9",RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add",KERNEL=="sdc10",RUN+="/bin/raw /dev/raw/raw14 %N"
KERNEL=="raw[1-9]", OWNER="oracle", GROUP="oinstall", MODE="640"
KERNEL=="raw1[0-4]", OWNER="oracle", GROUP="oinstall", MODE="640"

# start_udev
刷新裸设备
这样系统在下次启动时,会重新建立需要的raw设备名(上面的东西可以使用通配符来简化内容,但是我在使用通配符总是不能完全匹配)。
上面的操作可能需要先创建oracle用户和组。

RHEL5上裸设备上面安装Oracle 10g