在RedHat Linux 5.5 (x32/x64)上安装Oracle 10g r2(10.2.0.5)

RedHat Linux 5.5 (x32/x64)上安装Oracle 10g r2(10.2.0.5)

(原创: flexitime ,转载请注明出处,谢谢)

总述

要安装Oracle 10.2.0.5必须先安装10.2.0.1,安装顺序为

10.2.0.1->10.2.0.5->EM补丁->创建实例->修复EM中文乱码问题->创建自启动

1.安装rpm

nano /v.sh

将下面内容复制进去

对于 x64位版

#!/bin/bash

rpm -Uvh kernel-headers-2.6.18-194.el5.x86_64.rpm

rpm -Uvh glibc-headers-2.5-49.x86_64.rpm

rpm -Uvh glibc-devel-2.5-49.i386.rpm

rpm -Uvh glibc-devel-2.5-49.x86_64.rpm

rpm -Uvh libgomp-4.4.0-6.el5.x86_64.rpm

rpm -Uvh compat-gcc-34-3.4.6-4.x86_64.rpm

rpm -Uvh libstdc++-devel-4.1.2-48.el5.x86_64.rpm

rpm -Uvh gcc-4.1.2-48.el5.x86_64.rpm

rpm -Uvh gcc-c++-4.1.2-48.el5.x86_64.rpm

rpm -Uvh make-3.81-3.el5.x86_64.rpm

rpm -Uvh libXp-1.0.0-8.1.el5.x86_64.rpm

rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm

rpm -Uvh openmotif-2.3.1-2.el5_4.1.x86_64.rpm

rpm -Uvh setarch-2.0-1.1.x86_64.rpm

rpm -Uvh compat-db-4.2.52-5.1.x86_64.rpm

rpm -Uvh compat-gcc-34-3.4.6-4.x86_64.rpm

rpm -Uvh compat-gcc-34-c++-3.4.6-4.x86_64.rpm

rpm -Uvh compat-libstdc++-33-3.2.3-61.x86_64.rpm

rpm -Uvh libXau-devel-1.0.1-3.1.x86_64.rpm

rpm -Uvh libXau-devel-1.0.1-3.1.i386.rpm

rpm -Uvh libXp-devel-1.0.0-8.1.el5.x86_64.rpm

rpm -Uvh libXp-devel-1.0.0-8.1.el5.i386.rpm

 

 

对于 x32版本

#!/bin/bash

rpm -Uvh kernel-headers-2.6.18-194.el5.i386.rpm

rpm -Uvh glibc-headers-2.5-49.i386.rpm

rpm -Uvh glibc-devel-2.5-49.i386.rpm

rpm -Uvh libgomp-4.4.0-6.el5.i386.rpm

rpm -Uvh compat-gcc-34-3.4.6-4.i386.rpm

rpm -Uvh libstdc++-devel-4.1.2-48.el5.i386.rpm

rpm -Uvh gcc-4.1.2-48.el5.i386.rpm

rpm -Uvh gcc-c++-4.1.2-48.el5.i386.rpm

rpm -Uvh make-3.81-3.el5.i386.rpm

rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm

rpm -Uvh openmotif-2.3.1-2.el5_4.1.i386.rpm

rpm -Uvh setarch-2.0-1.1.i386.rpm

rpm -Uvh compat-db-4.2.52-5.1.i386.rpm

rpm -Uvh compat-gcc-34-3.4.6-4.i386.rpm

rpm -Uvh compat-gcc-34-c++-3.4.6-4.i386.rpm

rpm -Uvh compat-libstdc++-33-3.2.3-61.i386.rpm

rpm -Uvh libXau-devel-1.0.1-3.1.i386.rpm

rpm -Uvh libXp-devel-1.0.0-8.1.el5.i386.rpm

存盘,

转到安装 dvdrpm目录下(CentosCentos 目录, Oralce Linux Server目录),执行

bash /v.sh

 

2.调整内核参数

nano /etc/sysctl.conf

 

#将原来的# kernel.shmmaxkernel.shmall这两行参数屏蔽

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   --重新加载

 

nano /etc/security/limits.conf --加入以下四行代码

* soft nproc 2047

* hard nproc 16384

* soft nofile 1024

* hard nofile 65536

 

 

nano /etc/pam.d/login --加入下面一行代码

session required        pam_limits.so

 

 

3.增加用户及组

groupadd oinstall

groupadd dba

groupadd oper

useradd -g oinstall -G dba oracle

passwd oracle

 

4.创建安装Oracle的文件夹,并设置其相应权限给Oracle用户。

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

chown -R oracle.oinstall /u01

chmod 775 /u01

 

5.伪装操作系统版本,使安装Oracle时,通过操作系统验证。

cp /etc/redhat-release /etc/redhat-release.bak

nano /etc/redhat-release

替换为如下代码:

redhat-4

 

 

6. 设置Oracle环境变量(可根据你的需要作适当更改)

 

nano /home/oracle/.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/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

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export LANG=AMERICAN_AMERICA.ZHS16GBK

 

if [ $USER = "oracle" ]; then

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

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

 

nano  /etc/sysconfig/i18n   #改字符,不然安装时会改码

修改为

LANG="en_US.UTF-8"

 

7.将安装包文件复制到/u01/(必须要先安装10.2.0.1)

 gunzip 10201_database_linux_x86_64.cpio.gz

cpio -idmv < 10201_database_linux_x86_64.cpio

rm 10201_database_linux_x86_64.cpio

cd /

chown -R oracle.oinstall /u01

 

8.oracle身份登录图形界面进行安装

cd /u01/database

./runInstaller

安装时选择“高级 ”-….. Install software only

选择语言,添加中文支持

 

 

安装完成后,以root用户执行

 

cd /u01/app/oracle/oraInventory/

./orainstRoot.sh

 

cd /u01/app/oracle/product/db_1/

./root.sh

 

EOF

9.重新调整内核参数以适应10.2.0.5

nano /etc/sysctl.conf 增加以下内容

fs.file-max = 101365

net.core.rmem_default = 1048576

net.core.rmem_max = 1048576

net.ipv4.ip_local_port_range = 9000 65500

 

/sbin/sysctl –p

 

解压

unzip p8202632_10205_Linux-x86-64.zip

进入目录

./runInstaller -force -ignoresysprereqs

 

安装完成后,以root用户执行

cd /u01/app/oracle/product/db_1/

./root.sh

 

10.EM补丁p8350262_10205_Generic

解压并授权oracle,打开终端,用oracle用户执行命令,cd到该目录下,如/app/install/8350262,执行命令

/u01/app/oracle/product/db_1/OPatch/opatch apply

 

11.创建数据库实例

运行 dbca

……

 

12.Oracle改成自启动

1.编辑 /etc/oratab (以root 身份)

最下一行

orcl:/u01/app/oracle/product/db_1:N

改为

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

 

2.新建一个文件 nano /etc/init.d/oracledb(以root 身份)

 

 

#!/bin/bash

#

# oracledb This Starts/Stops the Oracle Server

# chkconfig: 345 99 10

# description: script for the Oracle Instance, Listener 

# /etc/init.d/oracledb

#

# Run-level Startup script for the Oracle Listener and Instances

# It relies on the information on /etc/oratab

 

export ORACLE_OWNR=oracle

export ORACLE_HOME=/u01/app/oracle/product/db_1

 

echo "Oracle Script init.d"

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]

then

  echo "Oracle startup: cannot start"

  exit 1

fi

case "$1" in

start)

  # Oracle listener and instance startup

  echo -n "Starting Oracle: "

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"

  touch /var/lock/oracle

  echo "OK"

  ;;

stop)

  # Oracle listener and instance shutdown

  echo -n "Shutdown Oracle: "

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"

  su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"

  rm -f /var/lock/oracle

  echo "OK"

  ;;

reload|restart)

  $0 stop

  $0 start

;;

*)

  echo "Usage: `basename $0` start|stop|restart|reload"

  exit 1

esac

exit 0

 

------------------备注说明 ---------------------------------
# chkconfig: 345 99 10
指出345级别启动这个服务,99是在相应的/etc/rc.d/rcN.d(N为前面指定的
级别,这里是345)目录下生成的链接文件的序号(启动优先级别)S99oradbstart
10
为在除前面指出的级别对应的/etc/rc.d/rcN.d(N为除345之外的级别)目录生成的
链接文件的序号(服务停止的优先级别)K10oradbstart

 撤销服务的话:chkconfig --del oracledb

 

4.增加启动项(Root执行)

chmod +x /etc/rc.d/init.d/oracledb

/sbin/chkconfig --add oracledb

/sbin/chkconfig --list |grep oracle

――――――――――――――――

要删除Oracle

先用dbca取消 实例

 

userdel –r oinstall

userdel –r oracle

groupdel dba

groupdel oper

 

再删除 /u01/app/…..

你可能感兴趣的:(Oracle,Linux)