CentOS7.2静默安装oracle11g

 

 

操作系统版本

安装软件包

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

检测是否安装

[root@docker ~]# 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组,创建oracle用户并且设置密码

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

验证创建是否正确

配置内核参数

vim /etc/sysctl.conf在尾部添加

# For oracle
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
# End oracle

设置生效sysctl -p

修改用户限制

 vim /etc/security/limits.conf

# For oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
# End oracle

在/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 /home/oracle/app/oracle
chown -R oracle:oinstall /home/oracle/app/oracle
chmod -R 775 /home/oracle/app/oracle

切换为oracle用户配置环境变量

vim ~./.bash_profile

export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_SID=orcl

设置生效

source ~/.bash_profile

解压下载好的oracle软件

我放置的位置为/home/oracle/tools

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

复制相应文件模板

mkdir /home/oracle/etc
cp /home/oracle/tools/database/response/* /home/oracle/etc/

设置响应文件权限

su - 

chmod 700 /home/oracle/etc/*.rsp

 

静默安装oracle软件

su - oracle

修改安装oracle软件的响应文件

vim /home/oracle/etc/db_install.rsp

 

oracle.install.option=INSTALL_DB_SWONLY     // 安装类型
ORACLE_HOSTNAME=oracle       // 主机名称(hostname查询)
UNIX_GROUP_NAME=oinstall     // 安装组
INVENTORY_LOCATION=/home/oracle/app/oracle/oraInventory   //INVENTORY目录(不填就是默认值)
SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/db_1    
ORACLE_BASE=/home/oracle/app/oracle    //oracle_base
oracle.install.db.InstallEdition=EE     // oracle版本
oracle.install.db.isCustomInstall=false   //自定义安装,否,使用默认组件
oracle.install.db.DBA_GROUP=dba /  / dba用户组
oracle.install.db.OPER_GROUP=oinstall // oper用户组
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName
oracle.install.db.config.starterdb.SID=orcl      //SID
oracle.install.db.config.starterdb.memoryLimit=10240 //自动管理内存的内存(M)
oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false         //(手动写了false)
DECLINE_SECURITY_UPDATES=true   //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)

PS:正式配置文件不能加后面备注否则在静默安装的时候会提示参数错误

开始静默安装

进入解压后的database目录

./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp

使用root用户执行脚本

su - root

sh /home/oracle/app/oraInventory/orainstRoot.sh
sh /home/oracle/app/product/11.2.0/db_1/root.sh

增加或者修改oracle环境变量

su - oracle

vim ~/.bash_profile

#for oracle
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_SID=orcl
export ROACLE_PID=ora11g
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin

export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

设置生效

source ~/.bash_profile

配置监听程序

netca /silent /responsefile /home/oracle/etc/netca.rsp

启动监听程序

lsnrctl start

查看监听状态

 PS:

如果设置监听出现以下错误,执行relink all即可

 

静默dbca建库

编辑应答文件

vim /home/oracle/etc/dbca.rsp

[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "AL32UTF8"

建库

dbca -silent -responseFile /home/oracle/etc/dbca.rsp

PS:屏幕会闪动,需要输入设置的密码

 

参考:http://www.cnblogs.com/zydev/p/5827207.html

posted @ 2017-10-18 12:57  minseo  阅读(457)  评论(0编辑  收藏  举报