安装oracle10g for RHEL4

1、 硬件要求

内存:建议大于1024MB

交换分区:内存少于等于1024MB 交换分区是内存的2倍

内存1025MB~2048MB 交换分区是内存的1.5倍

内存2049MB~8192MB 交换分区大小等于内存

内存大于8192MB 交换分区是内存的0.75倍

/temp至少400MB

检查内存是否满足要求:# grep MemTotal /proc/meminfo

检查交换分区是否满足要求:#grep SwapTotal /proc/meminfo

确认一下你的系统架构,看你准备的oracle安装包

是否正确:grep "model name" /proc/cpuinfo

swap分区的调整
步骤如下:
1.先以root用户登录
2.用dd创建一个有连续空间的大文件
dd if=/dev/zero of=swapfile bs=1024 count=1200000
其中count=1200000就表示1200000k啦
3.以交换分区的格式化它
mkswap swapfile
4.激活这个文件
swapon swapfile

2、 软件包要求:

binutils-2.15.92.0.2-13.EL4

compat-db-4.1.25-9

compat-libstdc++-296-2.96-132.7.2

control-center-2.8.0-12

gcc-3.4.3-22.1.EL4

gcc-c++-3.4.3-22.1.EL44

glibc-2.3.4-2.9

glibc-common-2.3.4-2.9

gnome-libs-1.4.1.2.90-44.1

libstdc++-3.4.3-22.1

libstdc++-devel-3.4.3-22.1

make-3.80-5

pdksh-5.2.14-30

sysstat-5.0.5-1

xscreensaver-4.18-5.rhel4.2

libaio-0.3.96

setarch-1.6-1

保证系统里面安装了以上版本或者更高版本的软件包,可以在安装系统的时候选择安装以下软件包:

    • Desktop
      • X Window System
      • Gnome
    • Applications
      • Graphical Internet (optional)
    • Development
      • Development Tools
      • Legacy Software Development
    • System
      • Administration Tools
      • System Tools
        • Add the package ’sysstat’ by clicking on the Details link and selecting "sysstat – The sar an iostat system monitoring commands." from the Optional Packages list.

检查所需要的软件包:

#rpm -q binutils compat-db compat-libstdc++-296 control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio setarch

哪个没有就在光盘里找吧!

3、 创建oracle用户和用户组

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle

给oracle用户添加密码:

# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

4、 创建相关目录

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

5、 关闭SELINUX

vi /etc/selinux/config 确保以下内容
SELINUX=disabled

6、 配置相关参数

A. 设置内核参数

vi /etc/sysctl.conf 在末尾添加以下内容:

kernel.shmall = 2097152
kernel.shmmax = 536870912 #这个是物理内存的一半,单位:字节512*1024*1024
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.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144

立即应用以上参数设置

# /sbin/sysctl -p

检查设置的参数,看输出的参数和设置的参数是否一致:

/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/sbin/sysctl -a | grep wmem_max

B. 为oracle用户设置shell limits:

vi /etc/security/limits.conf 在行末添加:

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

session required pam_limits.so

vi /etc/profile 在最后添加:

if [ $USER = "oracle" ]; then

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

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

C. 设置oracle用户的环境

以oracle用户登录(前面的操作都是root帐户)

vi /home/oracle/.bash_profile 添加:

umask 022

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

运行该文件:. ./.bash_profile

7、 安装oracle10g

上传安装文件,没有的话就到这里下载

http://www.oracle.com/technology/software/products/database/oracle10g/index.html

或者

http://61.132.102.124/oracle/10g/ 这儿还有10203的升级包,嘿嘿

解压

运行安装文件

./runInstaller

跟着向导一步一步走,最后提示用root帐号运行两个脚本,OK

8、 设置开机启动oracle

A. 登录root帐户

B. 修改/etc/oratab文件,将orcl那一行的N,设置为Y

C. 修改$ORACLE_HOME/bin/dbstart, dbshut ,将

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle/bin/tnslsnr

改成:

ORACLE_HOME_LISTNER=$ORACLE_HOME

D. 新建一个启动脚本,如下:

vi /etc/init.d/oracle

#!/bin/bash
#
# chkconfig: 345 90 05
# description: Oracle 10g Server
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracle"

# if the executables do not exist — display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter — startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
#su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle

su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
#su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle

su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0

E. 设置脚本的执行权限

chmod a+x /etc/init.d/oracle

F. 设置成自启动

chkconfig oracle on

——————————–大功告成————————–

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>