RHEL5.2 安装 Oracle  <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10g <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

一、安装 RHEL5.2
   
这部分没有特殊需要介绍的,基本上Step by Step即可,并且之后如果有需要也可以在后面进行配置或者安装其他包。

    二、针对 Oracle 配置 RHEL5.2
   
需要检查安装 Oracle 10g所需的所有程序包和更新以及对系统进行配置,以便具备相应的环境。
    2.1 RHEL5.2 
内核版本(root)
   
检查RHEL5.2内核版本 :
   
[root@RHEL ~]# uname -r
    2.6.18-92.el5xen
    2.2 Oracle  10g 
所需程序包(root)
   
检查Oracle 10g安装所需要的内核版本 :
   
[root@RHEL ~]# rpm -q gcc make binutils openmotif
    gcc-4.1.2-42.el5
    make-3.81-3.el5
    binutils-2.17.50.0.6-6.el5
    openmotif  is not installed
   
查询其他包安装情况:
   
[root@RHEL ~]#  rpm -q gcc make binutils openmotif setarch compat-db compat-gcc \
> compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

    gcc-4.1.2-42.el5
    make-3.81-3.el5
    binutils-2.17.50.0.6-6.el5
    openmotif-2.3.0-0.5.el5
    setarch-2.0-1.1
    compat-db-4.2.52-5.1
    package compat-gcc is not installed
    package compat-gcc-c++ is not installed
    package compat-libstdc++ is not installed
    package compat-libstdc++-devel is not installed
   
那么安装之。这些包在RHELDVD安装盘上的server目录下都有,只要找到安装即可。
   
[root@RHEL ~]# cd "/media/RHEL_5.2 i386 DVD/Server"
   
[root@RHEL Server]# rpm -Uvh setarch-2*
warning: setarch-2.0-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package setarch-2.0-1.1 is already installed
   
[root@RHEL Server]# rpm -Uvh make-3*
warning: make-3.81-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package make-3.81-3.el5 is already installed
   
[root@RHEL Server]# rpm -Uvh glibc-2*
warning: glibc-2.5-24.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
warning: package glibc = 2.5-24 was already added, skipping glibc < 2.5-24
error: error reading from file glibc-2.5-24.i686.rpm
   
[root@RHEL Server]# rpm -Uvh libaio-0*
warning: libaio-0.3.106-3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package libaio-0.3.106-3.2 is already installed
   
[root@RHEL Server]#  rpm -Uvh compat-libstdc++-33-3*
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package compat-libstdc++-33-3.2.3-61 is already installed
   
[root@RHEL Server]# rpm -Uvh compat-gcc-34-3*
warning: compat-gcc-34-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:compat-gcc-34          ########################################### [100%]
   
[root@RHEL Server]# rpm -Uvh compat-gcc-34-c++-3*
warning: compat-gcc-34-c++-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:compat-gcc-34-c++      ########################################### [100%]
    [root@RHEL Server]#  rpm -Uvh gcc-4*
warning: gcc-4.1.2-42.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package gcc-4.1.2-42.el5 is already installed
    [root@RHEL Server]#  rpm -Uvh libXp-1*
warning: libXp-1.0.0-8.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:libXp                  ########################################### [100%]
    [root@RHEL Server]# rpm -Uvh openmotif-2*
warning: openmotif-2.3.0-0.5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:openmotif              ########################################### [100%]
    [root@RHEL Server]#  rpm -Uvh compat-db-4*
warning: compat-db-4.2.52-5.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:compat-db              ########################################### [100%]

   
安装完成后,再次查询,可能发现如下包依然没有安装:
    package compat-gcc is not installed
    package compat-gcc-c++ is not installed
    package compat-libstdc++ is not installed
    package compat-libstdc++-devel is not installed
   
但是,如果再次安装的,又会提示already installed。后来也没管了,安装Oracle 10g会正常通过。
    2.3 
验证系统要求(root)
   
[root@RHEL ~]# grep MemTotal /proc/meminfo
    MemTotal:      1086464 kB
   
[root@RHEL ~]# grep SwapTotal /proc/meminfo
    SwapTotal:     2031608 kB
   
所需最小 RAM 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。Oracle 10g软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的可用空间。要检查系统上的可用磁盘空间,运行以下命令:
   
[root@RHEL ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       18G  5.4G   11G  33% /
/dev/sda1             244M   14M  218M   6% /boot
tmpfs                 531M     0  531M   0% /dev/shm
/dev/hdc              2.9G  2.9G     0 100% /media/RHEL_5.2 i386 DVD
   
以上是我虚拟机的环境,我只在虚拟机上挂了一个盘。
    2.4 
创建 Oracle 组和用户帐户(root)
   
[root@RHEL ~]# /usr/sbin/groupadd oinstall
   
[root@RHEL ~]# /usr/sbin/groupadd dba
   
[root@RHEL ~]# /usr/sbin/useradd -m -g oinstall -G dba oracle
   
[root@RHEL ~]# /usr/sbin/useradd -m -g oinstall -G dba oracle
   
[root@RHEL ~]# id oracle
    uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
   
[root@RHEL ~]# passwd oracle
    Changing password for user oracle.
    New password:
    Retype new password:
    passwd:all authentication tokens updated successfully.
    2.5 
创建安装目录(root)
   
创建存储 Oracle 10g软件和数据库文件的目录。在创建目录结构时所用的命名惯例符合最佳灵活结构 (OFA) 规范。
   
[root@RHEL ~]# mkdir -p /usr/app/oracle/product/10.2.0/db_1
   
[root@RHEL ~]# mkdir -p /usr/app/oracle/product/10.2.0/oradata
   
[root@RHEL ~]# mkdir -p /usr/app/oracle/install
   
[root@RHEL ~]# chown -R oracle:oinstall /usr/app/oracle
   
[root@RHEL ~]# chmod -R 775 /usr/app/oracle
   
创建/usr/app/oracle/install目录是用作安装Oracle的位置,随便放在/mnt/Ora10G也是一样。

 

 

 

2.6  配置 RHEL5.2 内核参数(root)
    Linux
内核非常出色。与大多数其他UNIX 系统不同,Linux 允许在系统启动和运行时修改大多数内核参数。完成内核参数更改后不必重新启动系统。Oracle 数据库 10g需要以下所示的内核参数设置。其中给出的是最小值,因此如果您的系统使用的值较大,则不要更改它。。
   
kernel.shmall = 2097152
    kernel.shmmax = 2147483648
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    具体地,是修改/etc/sysctl.conf的内容。通常,网上使用cat或者vi来编辑该文件。其实,gedit比这些都好用多了,并且对照来看看哪些参数可以设置了,尤其是cat只是追加上去,可能会造成一个参数有多个配置。下面是我的配置情况:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
#
这个值本身比推荐值大,所以保持不变
kernel.shmmax = 4294967295
       
# Controls the maximum number of shared memory segments, in pages
#
这个值本身比推荐值大,所以保持不变
kernel.shmall = 268435456

# For Oracle Install

kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
#
这几个参数不在Oracle文档内。在Oracle安装自检时,却会检测这些参数。
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144

   
增加的这几个参数(rmem_defaultrmem_maxwmem_defaultwmem_max),一开始我没设置,在Oracle安装自检时会报警告错误。这部分提前说明,具体警报信息如下:
   
[oracle@RHEL oracle]$ cd /usr/app/oracle/install
   
[oracle@RHEL install]$ ./runInstaller
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9,
redhat-4 , UnitedLinux-1.0, asianux-1 or asianux-2
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-12-30_04-17-29PM. Please wait ...



Checking operating system requirements ...
Expected result: One of redhat-3,redhat-4,SuSE-9,asianux-1,asianux-2
Actual Result: redhat-4
Check complete. The overall result of this check is: Passed
=========================
华丽分割线==========================

Checking operating system package requirements ...
Checking for make-3.79; found make-1:3.81-3.el5.    Passed
Checking for binutils-2.14; found binutils-2.17.50.0.6-6.el5.    Passed
Checking for gcc-3.2; found gcc-4.1.2-42.el5.    Passed
Checking for libaio-0.3.96; found libaio-0.3.106-3.2.    Passed
Check complete. The overall result of this check is: Passed
=========================
华丽分割线==========================

Checking kernel parameters
Checking for semmsl=250; found semmsl=250.    Passed
Checking for semmns=32000; found semmns=32000.    Passed
Checking for semopm=100; found semopm=100.    Passed
Checking for semmni=128; found semmni=128.    Passed
Checking for shmmax=536870912; found shmmax=4294967295.    Passed
Checking for shmmni=4096; found shmmni=4096.    Passed
Checking for shmall=2097152; found shmall=268435456.    Passed
Checking for file-max=65536; found file-max=65536.    Passed
Checking for VERSION=2.6.9; found VERSION=2.6.18-92.el5xen.    Passed
Checking for ip_local_port_range=1024 - 65000; found ip_local_port_range=1024 - 65000.    Passed
Checking for rmem_default=262144; found rmem_default=109568.   
Failed <<<<
Checking for rmem_max=262144; found rmem_max=131071.   
Failed <<<<
Checking for wmem_default=262144; found wmem_default=109568.   
Failed <<<<
Checking for wmem_max=262144; found wmem_max=131071.   
Failed <<<<
Check complete. The overall result of this check is:
Failed <<<<
Problem: The kernel parameters do not meet the minimum requirements (see above).
Recommendation: Perform operating system specific instructions to update the kernel parameters.
=========================
华丽分割线 ==========================
Checking Recommended glibc version
Expected result: ATLEAST=2.3.2-95.27
Actual Result: 2.5-24
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ==========================

Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 1060MB
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ==========================

Checking available swap space requirements ...
Expected result: 1590MB
Actual Result: 1983MB
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ===========================

Checking Network Configuration requirements ...
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ===========================

Validating ORACLE_BASE location (if set) ...
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ===========================

Checking Oracle Home path for spaces...
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ===========================

Checking for proper system clean-up....
Check complete. The overall result of this check is: Passed
=========================
华丽分割线 ===========================

Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed
=========================
华丽分割线===========================

    如果进行了上述设置之后,那么自检的时候就会全部Passed。可以通过/sbin/sysctl -p来查看/etc/sysctl.conf的配置情况。
    2.7 
oracle 用户设置 Shell 限制(root)
    Oracle
建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。要进行如下这些更改。同样使用gedit来完成。
   
/etc/security/limits.conf中增加如下配置:
# For Oracle Install
oracle               soft    nproc   2047
oracle               hard    nproc   16384
oracle               soft    nofile  1024
oracle               hard    nofile  65536
    /etc/pam.d/login中增加如下配置:
# For Oracle Install
session    required     /lib/security/pam_limits.so
    /etc/profile中增加如下配置:
# For Oracle Install
if [ \$USER = "oracle" ]; then 
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
    umask 022
fi
    /etc/csh.login中增加如下配置:
# For Oracle Install
if ( \$USER == "oracle" ) then
    limit maxproc 16384
    limit descriptors 65536
    umask 022
endif
    2.8 配置 oracle 用户的环境变量(oracle)
   
上面的操作都是在root用户下,这个配置需要以oracle用户登录系统进行配置。
   
[oracle@RHEL ~]$ gedit .bash_profile
   
具体配置如下:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH


# For Oracle Install

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/usr/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME

ORACLE_SID=orcl; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi
    2.9
配置 oracle 用户的环境变量 (root)
    有的提到需要修改/etc/hosts文件,将127.0.0.1修改成为你的实际IP地址,否则有可能导致安装Oracle的时候,检查网络配置异常。我也按照这个做了,但之后可能有麻烦,稍后再说。我是将其注释掉,具体修改如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
# ::1    localhost.localdomain    localhost    RHEL
# 127.0.0.1    RHEL.smnpc.com    localhost RHEL
10.10.10.197      RHEL.smnpc.com  RHEL
    2.10 Oracle
支持的RHEL版本(root)
   
2.6Oracle安装自检时,列出了Oracle10g支持的版本是:must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2。而我的系统是5.2。这里需要欺骗一下,具体的是修改文件/etc/redhat-release
   
[root@RHEL ~]# more /etc/redhat-release
    Red Hat Enterprise Linux Server release 5.2 (Tikanga)
   
5.2修改成4即可。网上也有说$ ./runInstaller -ignoreSysPrereqs方式来避免自检,但我没有实验过。也有的通过如下方式:
   
[root@RHEL ~]# gedit /usrapporacle/install/install/oraparam.ini
###[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2]

再添加
[Linux-redhat-5.0-optional]TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

 

完成oracle 10g安装