Centos7静默安装oracle11g

Posted 头痛不头痛

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7静默安装oracle11g相关的知识,希望对你有一定的参考价值。

操作系统:

[[email protected] ~]# uname -m
x86_64
[[email protected] ~]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core)

 

安装软件包:

参考官方:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCCADGD

  • The following or later version of packages for Oracle Linux 7, and Red Hat Enterprise Linux 7 must be installed:
binutils-2.23.52.0.1-12.el7.x86_64 
compat-libcap1-1.10-3.el7.x86_64 
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64 
gcc-c++-4.8.2-3.el7.x86_64 
glibc-2.17-36.el7.i686 
glibc-2.17-36.el7.x86_64 
glibc-devel-2.17-36.el7.i686 
glibc-devel-2.17-36.el7.x86_64 
ksh
libaio-0.3.109-9.el7.i686 
libaio-0.3.109-9.el7.x86_64 
libaio-devel-0.3.109-9.el7.i686 
libaio-devel-0.3.109-9.el7.x86_64 
libgcc-4.8.2-3.el7.i686 
libgcc-4.8.2-3.el7.x86_64 
libstdc++-4.8.2-3.el7.i686 
libstdc++-4.8.2-3.el7.x86_64 
libstdc++-devel-4.8.2-3.el7.i686 
libstdc++-devel-4.8.2-3.el7.x86_64 
libXi-1.7.2-1.el7.i686 
libXi-1.7.2-1.el7.x86_64 
libXtst-1.2.2-1.el7.i686 
libXtst-1.2.2-1.el7.x86_64 
make-3.82-19.el7.x86_64 
sysstat-10.1.5-1.el7.x86_64
unixODBC-2.3.1-6.el7.x86_64 or later
unixODBC-2.3.1-6.el7.i686 or later
unixODBC-devel-2.3.1-6.el7.x86_64 or later
unixODBC-devel-2.3.1-6.el7.i686 or later

用yum进行安装

yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

 

检测是否31个包都有安装

[[email protected] ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst  make sysstat  unixODBC unixODBC-devel
binutils-2.23.52.0.1-55.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.i686
gcc-4.8.5-4.el7.x86_64
gcc-c++-4.8.5-4.el7.x86_64
glibc-2.17-106.el7_2.8.x86_64
glibc-2.17-106.el7_2.8.i686
glibc-devel-2.17-106.el7_2.8.x86_64
glibc-devel-2.17-106.el7_2.8.i686
ksh-20120801-22.el7_1.3.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-0.3.109-13.el7.i686
libaio-devel-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.i686
libgcc-4.8.5-4.el7.x86_64
libgcc-4.8.5-4.el7.i686
libstdc++-4.8.5-4.el7.x86_64
libstdc++-4.8.5-4.el7.i686
libstdc++-devel-4.8.5-4.el7.x86_64
libstdc++-devel-4.8.5-4.el7.i686
libXi-1.7.2-2.1.el7.x86_64
libXi-1.7.4-2.el7.i686
libXtst-1.2.2-2.1.el7.x86_64
libXtst-1.2.2-2.1.el7.i686
make-3.82-21.el7.x86_64
sysstat-10.1.5-7.el7.x86_64
unixODBC-2.3.1-11.el7.x86_64
unixODBC-2.3.1-11.el7.i686
unixODBC-devel-2.3.1-11.el7.x86_64
unixODBC-devel-2.3.1-11.el7.i686

版本号只能大于规定的版本,不能小于。

 

创建oinstall和dba组

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba

创建oracle用户

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

设置oracle用户密码

passwd oracle

验证创建是否正确

[[email protected] ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)

 

配置内核参数

[[email protected] ~]# vim /etc/sysctl.conf 

# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 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

参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。

修改后使之生效

/sbin/sysctl -p

 

修改用户限制

vim  /etc/security/limits.conf

#在末尾添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
在/etc/pam.d/login 文件中,使用文本编辑器或vi命令增加或修改以下内容
session required /lib/security/pam_limits.so
session required pam_limits.so

在/etc/profile 文件中,使用文本编辑器或vi命令增加或修改以下内容

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

使之生效

source /etc/profile

 

创建安装目录

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

 

创建/etc/oraInst.loc文件,

[[email protected] ~]# vim /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory
inst_group=oinstall

更改文件权限

chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc 

 

配置环境变量

[[email protected] ~]$ vim ~/.bash_profile 

export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2

使之生效

source ~/.bash_profile

解压oracle软件

[[email protected] src]# unzip linux.x64_11gR2_database_1of2.zip
[[email protected] src]# unzip linux.x64_11gR2_database_2of2.zip

复制响应文件模板

[[email protected] ~]$ mkdir etc
[[email protected] ~]$ cp  /usr/local/src/database/response/* /home/oracle/etc/
[[email protected] ~]$ ls etc
dbca.rsp  db_install.rsp  netca.rsp

设置响应文件权限

[[email protected] ~]$ su - root

[[email protected] ~]# chmod 700 /home/oracle/etc/*.rsp

 

静默安装Oracle软件

su - oracle
修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsp
 
 

以上是关于Centos7静默安装oracle11g的主要内容,如果未能解决你的问题,请参考以下文章

Centos7静默安装oracle11g

Centos7静默安装Oracle11g

Centos7.0无桌面环境上静默安装oracle 11g

Centos7 静默安装Oracle11g以及可视化安装常见问题

CENTOS7.3(阿里云)静默安装ORACLE11g

Oracle 11g 基于CentOS7静默安装教程(无图形界面,远程安装)