oracle 11g完全安装教程(CentOS)

oracle下载链接:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

oracle官方安装文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm

下载时File1和File2都需要下载,下载需要用oracle账号登录如果没有要先注册。

1.创建用户

对于生产情况一般加入新磁盘用来装数据库,磁盘挂载教程另见。

本教程以oracle 11g r2为例,该版本配jdk1.5jdk1.6,jdk安装教程另见“OpenJDK换为JDK教程”。

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -d /oracle oracle
echo '0rac1e' | passwd oracle --stdin
cp /etc/skel/.bash* /oracle
chown -R oracle:oinstall /oracle

2.安装必备包

内网环境,安装前可能要配置本地yum源,更多yum源配置另见

cd /etc/yum.repos.d/&& mkdir backup&&mv * backup
cat > /etc/yum.repos.d/rhel6_cdrom.repo <<EOF
[RHEL6-Server]
name=RHEL6
baseurl=file:///path/to/mount_pos
enable=1
gpgcheck=0
EOF

yum update
yum install -y binutils  
compat-libcap1  
compat-libstdc++-33  
compat-libstdc++-33.i686  
gcc  
gcc-c++  
glibc.i686  
glibc  
glibc-devel  
glibc-devel.i686  
ksh  
libgcc.i686  
libgcc  
libstdc++  
libstdc++.i686  
libstdc++-devel  
libstdc++-devel.i686  
libaio  
libaio.i686  
libaio-devel  
libaio-devel.i686  
make  
sysstat  
unixODBC  
unixODBC.i686  
unixODBC-devel  
unixODBC-devel.i686  
glibc-common  
glibc-headers  
libXp.i686  
xorg-x11-apps  
xorg-x11-utils  
libXi  
elfutils-libelf-devel

另外需要安全的libXt.i686和libXtst.i686可能会出现Protected multilib versions问题,单独拿出安装:

yum install -y libXt.i686 libXtst.i686 --setopt=protected_multilib=false

3.配置内核

cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
#those 3 parameters seem to existed in defalut
#fs.file-max = 6815744
#kernel.shmall = 2097152
#kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 2500 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF

sysctl -p

4.配置用户资源限制

cat >> /etc/security/limits.conf << EOF
#those add for oracle 11g
oracle    soft    nofile    10240
oracle    hard    nofile    65536
oracle    soft    nproc     10000
oracle    hard    nproc     16384
oracle    soft   stack     10240
oracle    hard   stack     32768
EOF

5.关闭iptables和SELinux

由于oracle客户端和服务器的交互最终使用的是另外生成的随机端口而不是配置的监听端口(默认1521),如果iptables限制了任一端口都有可能使oracle连接失败,所以要关闭iptables。

又由于在开启SELinux的情况下,oracle会产生某些bug,所以要关闭SELinux。

service iptables status    #查看iptables状态
service iptables stop      #停止iptables
chkconfig iptables off     #禁止iptables开机自启动

sestatus                   #查看SELinux状态
setenforce 0               #将SELinux设为宽容模式,即只监视不阻止
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config    #禁用SELinux
reboot                     #环境实在不允许可不重启,因为设了宽容模式

6.解压并安装

在生产环境,可能要配置VNC以图形界面进行安装

xhost +  #当前桌面所属用户或root执行
su - oracle
unzip
linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip cd database
./runInstalle

 

如果之前完全安装了依赖包,则一般是依赖包版本已升级的原因,选择“Ignore All”进入下一步。

sh /oracle/app/oraInventory/orainstRoot.sh
sh /oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

至此Oracle数据库安装已完成,后续配置和创建数据库见“oracle 11g创建数据库教程

原文地址:https://www.cnblogs.com/lsdb/p/6512239.html