CentOS7.4 终端静默安装 Oracle 11g R2

2018-01-08 13:36:18来源:oschina作者:Colben人点击

分享
环境
CentOS7.4 最小安装
数据库软件
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip关闭 SELinux
sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
禁用 NetworkManager
systemctl disable NetworkManager
systemctl stop NetworkManager
重启操作系统
reboot
安装可能用到的工具
yum install epel-release
yum clean all
yum makecache fast
yum install vim unzip rlwrap
安装 oracle 需要的包
yum install binutils compat-libcap1 compat-libstdc++-33 /
compat-libstdc++-33*i686 gcc gcc-c++ glibc glibc*.i686 /
glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel /
libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel /
libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC /
unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
创建 oracle 用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
创建 oracle 安装目录
mkdir -p /opt/oracle/app/product/11.2.0
mkdir -p /opt/oracle/app/oradata
mkdir -p /opt/oracle/app/fast_recovery_area
mkdir -p /opt/oracle/inventory
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle
修改 sysctl.conf
cat << EOF >> /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 48719476736
kernel.shmmni = 4096
kernel.sem = 250 32000 200 200
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.core.rmem_max = 4194304
EOF
sysctl -p
修改 limits.conf
cat << EOF >> /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
修改 login
cat << EOF >> /etc/pam.d/login
session required/lib64/security/pam_limits.so
session required pam_limits.so
EOF
修改 profile
cat << EOF >> /etc/profile
if [ /$USER = "oracle" ] ; then
if [ /$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
修改 oracle 用户的 .bash_profile
cat << EOF >> /home/oracle/.bash_profile
export ORACLE_BASE=/opt/oracle/app
export ORACLE_HOME=/$ORACLE_BASE/product/11.2.0
export ORACLE_SID=orcl
export PATH=/$PATH:/$ORACLE_HOME/bin
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
EOF
上传数据库软件到 /root 下,解压
unzip linux.x64_11gR2_database_1of2.zip -d /home/oracle/
unzip linux.x64_11gR2_database_2of2.zip -d /home/oracle/
chown -R oracle.oinstall /home/oracle/database
切换到 oracle 用户,后续操作都在该 oracle 用户下执行
su - oracle
创建 response 文件
cd /home/oracle
cp database/response/*.rsp ./
修改 db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/app/product/11.2.0
ORACLE_BASE=/opt/oracle/app
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.password.ALL=111111
DECLINE_SECURITY_UPDATES=true
无需修改 netca.rsp
修改 dbca.rsp
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "111111"
SYSTEMPASSWORD = "111111"
CHARACTERSET = "ZHS16GBK"
安装 oracle 软件
cd /home/oracle/database
./runInstaller -silent -responseFile /home/oracle/db_install.rsp -ignorePrereq
# 安装成功后,系统提示需要在 root 下执行两个脚本
/opt/oracle/invertory/orainstRoot.sh
/opt/oracle/app/product/11.2.0/root.sh
配置监听
netca /silent /responseFile /home/oracle/netca.rsp
# 配置成功后,监听启动,查看监听状态
lsnrctl status
创建数据库
dbca -silent -responseFile /home/oracle/dbca.rsp
# 查看屏幕输出的创建进度
登陆数据库
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Releas 11.2.0.1.0 Production on Sat Jan 6 16:50:17 2018
Copyright (c) 1982, 2009, Oracle.All rights reserved.
SQL> conn /as sysdba
Connected.
SQL>

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台