【轉】redhat 5 安裝oracle10g方法

regonly1發表於2009-04-29

1.         硬體要求

 

   1.swap 分割槽不低於2G

   2.selinux 狀態disable

   3.實體記憶體不低於512M

 

2.         系統要求

     redhat Enterprise 5 預設安裝

 

3.         資料庫要求

3.1.軟體下載

      根據實際環環境從oracle官方網站下載相應的資料庫

     

       3.2.解包

      unzip 10201_database_linux32.zip

 

      解包完成後後將database目錄複製到/opt目錄下,以便oracle使用者安裝使用

 

4.     redhat配置

     

4.1         安裝缺失的包

用 root 使用者身份執行以下命令:

      rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

 

      如果採用預設安裝,該命令執行後通常會提示openmotif,compat-db,compat-gcc,compat-gcc-c++,compat-libstdc++,compat-libstdc++-devel 沒有安裝。如下所示

 

      gcc-4.1.1-52.el5

      make-3.81-1.1

      binutils-2.17.50.0.6-2.el5

      package openmotif is not installed

      setarch-2.0-1.1

      package compat-db is not installed

      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

          對缺失的包需要透過光碟或其他介質安裝,筆者採用光碟安裝

     

4.1.1          在/mnt 下建立cdrom

4.1.2          將光碟放入光碟機

4.1.3          執行命令 mount -t iso9660 /dev/cdrom /mnt/cdrom

命令執行後/mnt/cdrom下將產生光碟下面的檔案

4.1.4          進入光碟Server目錄下  cd /mnt/cdrom/Server

 

         由於缺失的包之間有嚴格的依賴關係,所以必須按照如下順序安裝缺失的包

     

        rpm -Uvh compat-db-4*
        rpm -Uvh libaio-0*
        rpm -Uvh compat-libstdc++-33-3*
        rpm -Uvh glibc-headers-2.5-12.i386.rpm
        rpm -Uvh glibc-devel-2.5-12.i386.rpm
        rpm -Uvh compat-gcc-34-3*
        rpm -Uvh compat-gcc-34-c++-3*
        rpm -Uvh libXp-1*
        rpm -Uvh openmotif-2*
        rpm -Uvh gcc-4*
        rpm -Uvh glibc-2.5-12.i686.rpm
        rpm -Uvh libgomp-4.1.1-52.el5.i386.rpm
        rpm -Uvh gcc-4.1.1-52.el5.i386.rpm


 

          安裝完成後仍然提示部分包沒有安裝,不過不影響使用

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

 

4.2     vi /etc/sysctl.conf file

      kernel.shmall = 2097152

      kernel.shmmax = 2147483648

      kernel.shmmni = 4096

      # semaphores: semmsl, semmns, semopm, semmni

      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

 

4.3     vi /etc/security/limits.conf vf

      * soft nproc 2047

      * hard nproc 16384

      * soft nofile 1024

* hard nofile 65536

 

4.4     vi /etc/pam.d/login

          session required /lib/security/pam_limits.so

 

4.5     vi /etc/selinux/config

      # This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - SELinux is fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use. Possible values are:

# targeted - Only targeted network daemons are protected.

# strict - Full SELinux protection.

#SELINUXTYPE=targeted

SELINUXTYPE=disabled

 

4.6     新增oracle使用者和組

groupadd oinstall

groupadd dba

groupadd oper

useradd –m -g oinstall -G dba oracle

passwd oracle

 

4.7     建立安裝目錄並賦予oracle相應許可權

mkdir -p /u01/app/oracle/product/10.2.0/db_1

chown -R oracle:oinstall /u01

chmod -R 775 /u01

 

4.8     新增訪問控制列表

xhost + machine-name

 

4.9     設定主機名和IP

vi /etc/hosts   

刪除檔案內容,新增如下兩行

127.0.0.1    localhost

IP地址      主機名稱

 

如果不新增第一行,安裝以後資料庫可以開啟,透過訪問  控制檯發現資料庫和監聽器均無法啟動(箭頭指向下)以管理員帳號進入em,頁面提示Network Adapter error,如果透過命令lsnrctl start提示如下錯誤

 

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 17-OCT-2007 15:35:07

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting .......

................
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=olivenan)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=olivenan)(PORT=1521)))
TNS-12547: TNS:lost contact
 TNS-12560: TNS:protocol adapter error
  TNS-00517: Lost contact
   Linux Error: 104: Connection reset by peer
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

 

4.10  修改redhat版本

vi /etc/redhat-release

Red Hat Enterprise Linux Server release 5 (Tikanga) 替換成 redhat-4

 

4.11  修改oracle的環境變數

su - oracle

vi ~/.bash_profile

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/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

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

#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL

if [ $USER = "oracle" ]; then

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

    ulimit -p 16384

    ulimit -n 65536

  else

    ulimit -u 16384 -n 65536

  fi

fi

export LANG=en_US.utf8

export LANGUAGE=en_US.utf8

export NLS_LANG="Simplified Chinese_China.UTF8"

export LC_ALL=en_US.utf8

 


4.13  安裝

以oracle使用者登入系統,開啟終端將當前位置定位到database中

Unset LANG

./runInstaller.sh

 

 


如果之前的包按照要求安裝完成,安裝過程應該很順利,如果安裝進度在63%左右出現錯誤,如提示遇到問題需要重試,忽略等等,一般就是系統要求的包沒有安裝完全。

 

 


安裝完成後重啟機子,登入oracle 開啟終端

 

 sqlplus ‘/as sysdba'

 啟動資料庫

 startup

 

 啟動控制檯

emctl start dbconsole

啟動監聽器

 lsnrctl start

 


 

 


4.14  後修改vi /etc/redhat-release 內容為Red Hat Enterprise Linux Server release 5 (Tikanga)

4.15  設定開機啟動

vi /etc/oratab

orcl:/u01/app/oracle/product/10.2.0/db_1:Y

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12932950/viewspace-592212/,如需轉載,請註明出處,否則將追究法律責任。

相關文章