Linux安装oracle 10G详细过程


一、安装Oracle前的系统准备工作

1.检查需要的软件包

yum install setarch* make* glibc* glibc*i686*  libaio* compat-libstdc* compat-gcc* compat-gcc-34-c* gcc* libXp* openmotif* compat-db*  libXp.i686 libXp-devel.i686 xhost + libXtst.x86_64 libXtst.i686 libXt.i686

2.修改Linux发行版本信息

# vi /etc/redhat-release

把CentOS release 6.4 (Final) 改为:redhat-4

3.修改系统内核参数

# vi /etc/sysctl.conf

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

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=4194304

net.core.rmem_max=4194304

net.core.wmem_default=4194304

net.core.wmem_max=4194304

# /sbin/sysctl -p

4.创建Oracle用户、组、安装目录

# groupadd oinstall

# groupadd dba

# useradd -g oinstall -G dba oracle

# passwd oracle

5.添加以下内容到/etc/security/limits.conf

# vi /etc/security/limits.conf

* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536

6.添加以下内容到/etc/pam.d/login

# vi /etc/pam.d/login

session required /lib/security/pam_limits.so 
session required pam_limits.so

7.添加以下内容到/etc/profile

# vi /etc/profile

if [ $USER = "oracle" ]; then 
if [ $SHELL = "/bin/ksh" ]; then 
ulimit -p 16384 
ulimit -n 65535
else 
ulimit -u 16384 -n 65535
fi 
fi

8.配置Linux主机

检查/etc/hosts文件中是否有localhost的记录(指向127.0.0.1即可),若没有的话,在后面配置Oracle监听的时候会出现一些问题,导致无法启动监听,在此手工添加此记录即可

9.配置oracle用户环境变量

# su - oracle

$ vi .bash_profile

export TMP=/home/oracle/tmp

export TMPDIR=$TMP

export ORACLE_BASE=/home/oracle

export ORACLE_SID=erp

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db

export PATH=/usr/sbin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:$ORACLE_HOME/bin:$ORACLE_BASE/common/oracle/bin:$PATH 

export LD_LIBARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH

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

export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"

PATH=$PATH:$HOME/bin

二、安装Oracle

1.解压缩安装文件

# zcat 10201_database_linux_x86_64.cpio.gz |cpio -idmv

或者

# gunzip 10201_database_linux_x86_64.cpio.gz 解压出10201_database_linux_x86_64.cpio文件然后再 # cpio -idvm  < 10201_database_linux_x86_64.cpio

# chown -R oracle:oinstall database/

2.安装Xmanager Enterprise 4

启动Xmanager - Passive

3. 用oracle帐户进入安装文件所在目录,执行如下命令即可根据界面操作:

# export DISPLAY=你的IP地址:0.0 
$ ./runInstaller

4.安装进度大约到65%时会有错误提示:
Error in invoking target 'collector' of makefile '/opt/oracle/102/sysman/lib/ins_emdb.mk'.

这是oracle安装程序的一个bug,可以忽略此错误继续安装,对系统没什么影响。

5.会遇到错误提示:

ORA-27125:unable to create shared memory segment

解决:

确定安装oracle所使用的用户组

# id oracle

可以看到oracle组dba id 为501。

修改内核参数

# vi /etc/sysctl.conf

vm.hugetlb_shm_group = 501

# sysctl -p