在RedHat及其衍生系统上安装Oracle 11gR1
oracle版本:11.1.0.6.0
redhat版本:RedHat EL4,5 Oracle EL 4,5 CentOS 4,5
安装过程分以下四个步骤
一,安装准备
二,下载安装
三,相关设置
四,常见错误
一,安装准备
1,创建oracle用户
以root用户登录,并创建oracle用户以及所属的dba组
su -
# groupadd dba
# useradd -g dba oracle
# mkdir /home/oracle
# chown oracle:dba /home/oracle
su -
# groupadd dba
# useradd -g dba oracle
# mkdir /home/oracle
# chown oracle:dba /home/oracle
2,配置系统参数
编辑 /etc/sysctl.conf 文件并添加下列参数:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
编辑后可以运行“sysctl -p” 生效,或者重启系统
对于redhat 版本4:编辑 /etc/pam.d/login 文件,并添加下行参数:
session required /lib/security/pam_limits.so
session required /lib/security/pam_limits.so
对于redhat 版本5:编辑 /etc/pam.d/login 文件,并添加下行参数:
session required pam_limits.so
session required pam_limits.so
编辑 /etc/security/limits.conf 并添加下行参数:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
3,创建oracle目录
# mkdir /opt/oracle
# mkdir /opt/oracle/111
# chown -R oracle:dba /opt/oracle
# mkdir /opt/oracle
# mkdir /opt/oracle/111
# chown -R oracle:dba /opt/oracle
4,设置oracle环境变量
编辑 /home/oracle/.bash_profile 并添加下列行:
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/111
ORACLE_SID=ORCL
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/111
ORACLE_SID=ORCL
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
保存后通过下面命令是配置生效
su - oracle
cd /home/oracle
. .bash_profile
su - oracle
cd /home/oracle
. .bash_profile
二,下载安装
1,下载并安装需要的rpm软件包
检查软件包安装情况:
rpm -q binutils elfutils elfutils-libelf gcc gcc-c++ glibc glibc-common glibc-devel compat-libstdc++-33 cpp make compat-db sysstat libaio libaio-devel unixODBC unixODBC-devel|sort
rpm -q binutils elfutils elfutils-libelf gcc gcc-c++ glibc glibc-common glibc-devel compat-libstdc++-33 cpp make compat-db sysstat libaio libaio-devel unixODBC unixODBC-devel|sort
相应软件包下载地址
RedHat Enterprise Linux 4:ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/
RedHat Enterprise Linux 5:ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/
Centos Linux 4:http://centos.arcticnetwork.ca/4/os/i386/CentOS/RPMS/
Centos Linux 5:http://centos.arcticnetwork.ca/5/os/i386/CentOS/
下载后使用rpm -ivh命令安装即可
2,下载oracle 11g
下载地址:http://www.oracle.com/technology/software/products/database/index.html
解压软件包
unzip linux_11gR1_database.zip
unzip linux_11gR1_database.zip
3,开始安装
cd database
./runInstaller
cd database
./runInstaller
三,相关配置
1,自动启动和关闭数据库实例和监听
编辑 /etc/oratab 修改最后参数为“Y”
ORCL:/opt/oracle/111:Y
以root用户在 /etc/init.d/ 目录中创建oracle文件,并添加下列内容
#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/111"
case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/111"
case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
设置脚本权限和自启动
chmod 750 /etc/init.d/oracle
chkconfig --add oracle --level 0356
chmod 750 /etc/init.d/oracle
chkconfig --add oracle --level 0356
2,自动启动和关闭 EM
以root用户在 /etc/init.d 中创建oraemctl 文件,并添加下面内容
#!/bin/bash
#
# oraemctl Starting and stopping Oracle Enterprise Manager Database Control.
# Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Enterprise Manager DB Control startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/111"
case "$1" in
start)
echo -n $"Starting Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
#!/bin/bash
#
# oraemctl Starting and stopping Oracle Enterprise Manager Database Control.
# Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Enterprise Manager DB Control startup script
# Source function library.
. /etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/111"
case "$1" in
start)
echo -n $"Starting Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
设置权限和自启动
chmod 750 /etc/init.d/oraemctl
chkconfig --add oraemctl --level 0356
chmod 750 /etc/init.d/oraemctl
chkconfig --add oraemctl --level 0356
四,常见错误
1,错误:DISPLAY not set. Please set the DISPLAY and try again.
以root用户打开终端或者ssh登录,通过下面命令均可可解决
命令一: export DISPLAY=:0.0
命令二: xhost +
2,错误:error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
安装libaio和libaio-devel软件包,如果仍重复提示错误,以root用户运行”ldconfig“命令可以解决
3,错误:Check complete. The overall result of this check is: Failed <<<<
检查缺失软件包并安装,或者修改系统参数为需要的值