rss· 投稿· 设为首页· 加入收藏· 繁體版
当前位置: 火魔网 » 操作系统 » Redhat

oracle 10g 在RedHat5.3安装文档全过程共享

在Linux下安装Oracle有以下步骤:

    1>.安装Linux.

    2>.针对Oracle配置Linux系统.

    3>.安装Oracle.

    4>.测试运行安装的Oracle系统.

    一.安装Linux.

    1.系统环境需求

    安装Redhat Linux的过程比较简单,我选用的Linux版本是Redhat Enterprise Linux 5.3,因需装Oracle10g,系统环境需求

如下:

    RAM:1GB(最低需求512MB)

    SWAP:2GB

    必须安装以下系统组件:GNOME桌面环境、编辑器、开发工具、开发库等.

    2.内核版本要求

    要在Linux上安装Oracle,所需内核版本:2.4.9-e.25(或更高版本)

    通过运行以下命令检查内核版本:

    # uname -r

    2.6.18-128.e15

    3.程序包安装和更新

    在安装好Linux后,需验证安装是否具备Oracle 10g所需要的所有程序包和更新,按以下步骤验证安装.

    所需程序包的版本(或更高版本):

    gcc-3.2.3-2

    make-3.79

    binutils-2.11

    openmotif-2.2.2-16

    setarch-1.3-1

    compat-gcc-7.3-2.96.122

    compat-gcc-c++-7.3-2.96.122

    compat-libstdc++-7.3-2.96.122

    compat-libstdc++-devel-7.3-2.96.122

    compat-db-4.0.14.5

    要查看系统上安装了这些程序包的哪些版本,以 root 用户身份运行以下命令:

    # rpm -q gcc make binutils openmotif setarch compat-db compat-gcc

             openmotif compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

    gcc-3.2.3-20

    make-3.79.1-17

    binutils-2.14.90.0.4-26

    openmotif-2.2.2-16

    setarch-1.3-1

    package compat-db is not installed

    compat-gcc-7.3-2.96.122

    compat-gcc-c++-7.3-2.96.122

    compat-libstdc++-7.3-2.96.122

    compat-libstdc++-devel-7.3-2.96.122

    如果系统上缺少任何程序包,或版本比以上指定的版本旧(compat-db 除外),则需要安装这些包,这些包在RHEL的DVD安

装盘上的server目录下都有.

    # cd "/media/RHEL_5.3 i386 DVD/Server"

    # rpm -Uvh setarch-2*

    # rpm -Uvh make-3*

    # rpm -Uvh glibc-2*

    # rpm -Uvh libaio-0*

    # rpm -Uvh compat-libstdc++-33-3*

    # rpm -Uvh compat-gcc-34-3*

    # rpm -Uvh compat-gcc-34-c++-3*

    # rpm -Uvh gcc-4*

    # rpm -Uvh libXp-1*

    # rpm -Uvh openmotif-2*

    # rpm -Uvh compat-db-4*

    二.针对Oracle配置Linux系统.

    Linux 软件现已安装完毕,需要针对 Oracle 对其进行配置。

    1.验证系统要求

    要验证系统是否满足 Oracle 10g 数据库的最低要求,以 root 用户身份登录并运行以下命令。

    要查看可用 RAM 和交换空间大小,运行以下命令:

    # grep MemTotal /proc/meminfo

    MemTotal:512236 kB

    # grep SwapTotal /proc/meminfo

    SwapTotal:1574360 kB

    所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两

倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。

    Oracle 10g 软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的

可用空间。要检查系统上的可用磁盘空间,运行以下命令:

    # df -h

    Filesystem        Size  Used Avail Use% Mounted on

    /dev/sda3         6.8G  1.3G  5.2G  20% /

    /dev/sda1         99M   17M   77M  18% /boot

    2.创建 Oracle 组和用户帐户

    Oracle数据库必须在Oracle用户下才能安装,所以需要建立相应的用户群组、用户,以及设置相应的目录属主、目录权限

    # groupadd oinstall

    # groupadd dba

    # groupadd oper

    # useradd -g oinstall -G dba oracle

    # mkdir -p /oracle/product/10.2.0/db_1

    # chown -R oracle.oinstall /oracle

    # chmod -R 775 /oracle

    # passwd oracle

    3.修改/etc/redhat-release文件

    获得Oracle10g认证的Redhat Linux最高版本为redhat-4, 所以需要修改redhat-release文件.

    # vi /etc/redhat-release

    # Red Hat Enterprise Linux Server release 5.3 (Tikanga)

    redhat-4

    4.配置Linux内核参数

    Linux 内核非常出色。与大多数其他 *NIX 系统不同,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

    以 root 用户身份登录后执行下命令

    # vi /etc/sysctl.conf

    # For Oracle

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128

    fs.file-max = 65536

    net.ipv4.ip_local_port_range = 1024 65000

    net.core.rmem_default = 262144

    net.core.rmem_max = 262144

    net.core.wmem_default = 262144

    net.core.wmem_max = 262144

    保存文件后执行以下命令激活更改.

    # /sbin/sysctl -p

    5.为oracle用户设置Shell限制

    Oracle 建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。要进行这些更改,以 root 用户的身份执行

下列命令:

    # vi /etc/security/limits.conf

    # For Oracle

    oracle soft nproc   2047

    oracle hard nproc  16384

    oracle soft nofile  1024

    oracle hard nofile 65536

    # vi /etc/pam.d/login

    Session required /lib/security/pam_limits.so

    以oracle用户身份运行以下命令:

    # vi .bash_profile

    if [ $USER = "oracle" ]; then

       if [ $SHELL = "/bin/ksh" ]; then

          ulimit -p 16384

          ulimit -n 65536

       else

          ulimit -u 16384 -n 65536

       umask 022

    以root用户身份运行以下命令:

    # vi /etc/csh.login

    if ( \$USER == "oracle" ) then

       limit maxproc 16384

       limit descriptors 65536

       umask 022

    endif

    6.修改Oracle用户语言环境:

    以oracle用户身份运行以下命令:

    $ touch .i18n

    $ vi .i18n

    LC_CTYPE="en"

    7.配置Oracle用户环境变量

    要使用 Oracle 产品,应该或必须设置几个环境变量。对于数据库服务器,建议设置以下环境变量:

    ORACLE_BASE

    ORACLE_HOME

    ORACLE_SID

    PATH

    如果您在同一服务器上安装了多个 Oracle 产品或数据库,则 ORACLE_HOME、ORACLE_SID 和 PATH 变量可能会更改。

ORACLE_BASE 变量不应更改,并可以在需要时在您的登录配置文件中设置它。Oracle 提供了一个称作 oraenv 的实用程序来设

置其他变量。

    以 oracle 身份登录,并通过在 .bash_profile 或 .profile(bash 或 ksh)中添加以下行,将 ORACLE_BASE 添加到登

录配置文件:

    $ vi .bash_profile

    # For Oracle

    TMP=/tmp; export TMP

    TMPDIR=$TMP; export TMPDIR

    ORACLE_BASE=/oracle; export ORACLE_BASE

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

    ORACLE_SID=ERP; 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

    三.安装Oracle

    首先运行xhost hostname命令启动X-Windows安装界面

    $ xhost mail.weiguo.com(以ROOT用户身份进行安装

    $ unzip 10201_database_linux32.zip

    $ cd database

    $ ./runInstaller

    进入图形安装界面,根据提示安装即可,与在Windows下安装一致.

    在安装的最后弹出一个“Setup Privileges”窗口,提示需要以 root 用户身份运行配置脚本。以 root 用户身份登录,

切换到该窗口中指示的目录, 然后执行 root.sh 脚本。该脚本提示输入本地 bin 目录的位置。按 Enter 键接受默认值。当脚

本完成时,返回到 Setup Privileges 窗口并单击 OK

    $ su root

    # /home/oracle/oralnventory/orainstRoot.sh

    # /oracle/product/10.2.0/db_1/root.sh

    安装完成后,恢复Oracle用户语言环境以及/etc/redhat-release文件。

    $ rm Cf .i18n

    # vi /etc/redhat-release

    Red Hat Enterprise Linux Server release 5.3 (Tikanga)

    四.测试运行安装的Oracle系统

    1.启动监听器:

    $ lsnrctl start

    2.启动及关闭数据库.

    $ sqlplus /nolog

    SQL> connect / as sysdba

    Connected to an idle instance.

    SQL> startup

    SQL> shutdown

    3.设置自启动:

    # vi /etc/oratab

    TSH1:/oracle/product/10.2.0/db_1:Y

Sing and we said...

SHMMAX = The maximum size(in bytes) of a single shared memory

         segment.

SHMMIN = The minimum size(in bytes) of a single shared memory

         segment.

The above settings let the max be bigger then we wil ever use and the min much

smaller.  They are sufficient for pretty much all systems.

SHMMNI = The number of shared memory identifiers.

SHMSEG = The maximum number of shared memory segments that can

         be attached by a process.

The above settings should also be sufficient.

SEMMNS = The number of semaphores in the system.

SEMMNI = The number of semaphore set identifiers in the system;

         determines the number of semaphore sets that can be

         created at any one time.

SEMMSL = The maximum number of sempahores that can be in one

         semaphore set. It should be same size as maximum number

         of Oracle processes

     (The PROCESSES parameter in the init.ora file).

SEMMSL

    Set to 10 plus the largest initsid.ora PROCESSES parameter of an Oracle

database on the system.  The PROCESSES parameter can be found in each

initsid.ora file, loc ORACLE_HOME/dbs directory. The default value of PROCESSES

for the 8.1.5 prebuilt database is 50.

SEMMNS

    Set to the sum of the PROCESSES parameter for each Oracle database the

largest one, plus 2 times the largest PROCESSES value, plus 10 number of Oracle

databases.  For example, consider a system that has three Oracle instances with

the PROCESSES parameter in their initsid.ora files set to the following values:

  ORACLE_SID=A, PROCESSES=100

  ORACLE_SID=B, PROCESSES=100

  ORACLE_SID=C, PROCESSES=200

顶一下
(1)
踩一下
(0)